summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/msun/src/s_truncl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/msun/src/s_truncl.c b/lib/msun/src/s_truncl.c
index c475b90..173b9ff 100644
--- a/lib/msun/src/s_truncl.c
+++ b/lib/msun/src/s_truncl.c
@@ -37,6 +37,7 @@ static char rcsid[] = "$FreeBSD$";
#endif
static const long double huge = 1.0e300;
+static const float zero[] = { 0.0, -0.0 };
long double
truncl(long double x)
@@ -47,7 +48,7 @@ truncl(long double x)
if (e < MANH_SIZE - 1) {
if (e < 0) { /* raise inexact if x != 0 */
if (huge + x > 0.0)
- u.e = 0.0;
+ u.e = zero[u.bits.sign];
} else {
uint64_t m = ((1llu << MANH_SIZE) - 1) >> (e + 1);
if (((u.bits.manh & m) | u.bits.manl) == 0)
OpenPOWER on IntegriCloud