diff options
author | bde <bde@FreeBSD.org> | 2008-02-08 01:45:52 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2008-02-08 01:45:52 +0000 |
commit | 4fa28da3c9c38d1bd9b235fa85b264caf475fe4c (patch) | |
tree | 8a061250971b1d069660d87f808161c04aba412b | |
parent | ef3758c4ac350e0bbd3b85584cd9d1849e285906 (diff) | |
download | FreeBSD-src-4fa28da3c9c38d1bd9b235fa85b264caf475fe4c.zip FreeBSD-src-4fa28da3c9c38d1bd9b235fa85b264caf475fe4c.tar.gz |
Fix truncl() when the result should be -0.0L. When the result is +-0.0L,
it must have the same sign as the arg in all rounding modes, but it was
always +0.0L.
-rw-r--r-- | lib/msun/src/s_truncl.c | 3 |
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) |