summaryrefslogtreecommitdiffstats
path: root/lib/msun/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/msun/src')
-rw-r--r--lib/msun/src/s_round.c12
-rw-r--r--lib/msun/src/s_roundf.c12
-rw-r--r--lib/msun/src/s_roundl.c12
3 files changed, 18 insertions, 18 deletions
diff --git a/lib/msun/src/s_round.c b/lib/msun/src/s_round.c
index 34b26f0..65de31b 100644
--- a/lib/msun/src/s_round.c
+++ b/lib/msun/src/s_round.c
@@ -38,14 +38,14 @@ round(double x)
return (x);
if (x >= 0.0) {
- t = ceil(x);
- if (t - x > 0.5)
- t -= 1.0;
+ t = floor(x);
+ if (t - x <= -0.5)
+ t += 1.0;
return (t);
} else {
- t = ceil(-x);
- if (t + x > 0.5)
- t -= 1.0;
+ t = floor(-x);
+ if (t + x <= -0.5)
+ t += 1.0;
return (-t);
}
}
diff --git a/lib/msun/src/s_roundf.c b/lib/msun/src/s_roundf.c
index a7a3da9..952e8e7 100644
--- a/lib/msun/src/s_roundf.c
+++ b/lib/msun/src/s_roundf.c
@@ -38,14 +38,14 @@ roundf(float x)
return (x);
if (x >= 0.0) {
- t = ceilf(x);
- if (t - x > 0.5)
- t -= 1.0;
+ t = floorf(x);
+ if (t - x <= -0.5)
+ t += 1.0;
return (t);
} else {
- t = ceilf(-x);
- if (t + x > 0.5)
- t -= 1.0;
+ t = floorf(-x);
+ if (t + x <= -0.5)
+ t += 1.0;
return (-t);
}
}
diff --git a/lib/msun/src/s_roundl.c b/lib/msun/src/s_roundl.c
index 0cb688b..a70b617 100644
--- a/lib/msun/src/s_roundl.c
+++ b/lib/msun/src/s_roundl.c
@@ -38,14 +38,14 @@ roundl(long double x)
return (x);
if (x >= 0.0) {
- t = ceill(x);
- if (t - x > 0.5)
- t -= 1.0;
+ t = floorl(x);
+ if (t - x <= -0.5)
+ t += 1.0;
return (t);
} else {
- t = ceill(-x);
- if (t + x > 0.5)
- t -= 1.0;
+ t = floorl(-x);
+ if (t + x <= -0.5)
+ t += 1.0;
return (-t);
}
}
OpenPOWER on IntegriCloud