diff options
author | Stefan Farfeleder <stefanf@FreeBSD.org> | 2005-04-28 19:45:55 +0000 |
---|---|---|
committer | Stefan Farfeleder <stefanf@FreeBSD.org> | 2005-04-28 19:45:55 +0000 |
commit | 66116c07a7016b2612615036ebf7f493f6f7e0bd (patch) | |
tree | 399a9854e18fb3743906a3dc42ba32ef9a4a8061 /lib | |
parent | 850bc9af6bd8f14dc633254809b5900c4f706517 (diff) | |
download | src-66116c07a7016b2612615036ebf7f493f6f7e0bd.tar.gz src-66116c07a7016b2612615036ebf7f493f6f7e0bd.zip |
Revert the last change, the conversion from long double to double can raise
unwanted underflow exceptions.
Pointed out by: das
Notes
Notes:
svn path=/head/; revision=145637
Diffstat (limited to 'lib')
-rw-r--r-- | lib/msun/src/s_ceill.c | 8 | ||||
-rw-r--r-- | lib/msun/src/s_floorl.c | 8 | ||||
-rw-r--r-- | lib/msun/src/s_truncl.c | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/msun/src/s_ceill.c b/lib/msun/src/s_ceill.c index 6abbe1064e49..1de973b0f62d 100644 --- a/lib/msun/src/s_ceill.c +++ b/lib/msun/src/s_ceill.c @@ -50,7 +50,7 @@ static char rcsid[] = "$FreeBSD$"; } while (0) #endif -static const double huge = 1.0e300; +static const long double huge = 1.0e300; long double ceill(long double x) @@ -60,7 +60,7 @@ ceill(long double x) if (e < MANH_SIZE - 1) { if (e < 0) { /* raise inexact if x != 0 */ - if (huge + (double)x > 0.0) + if (huge + x > 0.0) if (u.bits.exp > 0 || (u.bits.manh | u.bits.manl) != 0) u.e = u.bits.sign ? 0.0 : 1.0; @@ -76,7 +76,7 @@ ceill(long double x) #endif INC_MANH(u, 1llu << (MANH_SIZE - e - 1)); } - if (huge + (double)x > 0.0) { /* raise inexact flag */ + if (huge + x > 0.0) { /* raise inexact flag */ u.bits.manh &= ~m; u.bits.manl = 0; } @@ -95,7 +95,7 @@ ceill(long double x) INC_MANH(u, 1); } } - if (huge + (double)x > 0.0) /* raise inexact flag */ + if (huge + x > 0.0) /* raise inexact flag */ u.bits.manl &= ~m; } return (u.e); diff --git a/lib/msun/src/s_floorl.c b/lib/msun/src/s_floorl.c index d7d3fcf74462..9dd13b6cb1cc 100644 --- a/lib/msun/src/s_floorl.c +++ b/lib/msun/src/s_floorl.c @@ -50,7 +50,7 @@ static char rcsid[] = "$FreeBSD$"; } while (0) #endif -static const double huge = 1.0e300; +static const long double huge = 1.0e300; long double floorl(long double x) @@ -60,7 +60,7 @@ floorl(long double x) if (e < MANH_SIZE - 1) { if (e < 0) { /* raise inexact if x != 0 */ - if (huge + (double)x > 0.0) + if (huge + x > 0.0) if (u.bits.exp > 0 || (u.bits.manh | u.bits.manl) != 0) u.e = u.bits.sign ? -1.0 : 0.0; @@ -76,7 +76,7 @@ floorl(long double x) #endif INC_MANH(u, 1llu << (MANH_SIZE - e - 1)); } - if (huge + (double)x > 0.0) { /* raise inexact flag */ + if (huge + x > 0.0) { /* raise inexact flag */ u.bits.manh &= ~m; u.bits.manl = 0; } @@ -95,7 +95,7 @@ floorl(long double x) INC_MANH(u, 1); } } - if (huge + (double)x > 0.0) /* raise inexact flag */ + if (huge + x > 0.0) /* raise inexact flag */ u.bits.manl &= ~m; } return (u.e); diff --git a/lib/msun/src/s_truncl.c b/lib/msun/src/s_truncl.c index cb5e6c9311da..c475b904dccf 100644 --- a/lib/msun/src/s_truncl.c +++ b/lib/msun/src/s_truncl.c @@ -36,7 +36,7 @@ static char rcsid[] = "$FreeBSD$"; #define MANH_SIZE LDBL_MANH_SIZE #endif -static const double huge = 1.0e300; +static const long double huge = 1.0e300; long double truncl(long double x) @@ -46,13 +46,13 @@ truncl(long double x) if (e < MANH_SIZE - 1) { if (e < 0) { /* raise inexact if x != 0 */ - if (huge + (double)x > 0.0) + if (huge + x > 0.0) u.e = 0.0; } else { uint64_t m = ((1llu << MANH_SIZE) - 1) >> (e + 1); if (((u.bits.manh & m) | u.bits.manl) == 0) return (x); /* x is integral */ - if (huge + (double)x > 0.0) { /* raise inexact flag */ + if (huge + x > 0.0) { /* raise inexact flag */ u.bits.manh &= ~m; u.bits.manl = 0; } @@ -61,7 +61,7 @@ truncl(long double x) uint64_t m = (uint64_t)-1 >> (64 - LDBL_MANT_DIG + e + 1); if ((u.bits.manl & m) == 0) return (x); /* x is integral */ - if (huge + (double)x > 0.0) /* raise inexact flag */ + if (huge + x > 0.0) /* raise inexact flag */ u.bits.manl &= ~m; } return (u.e); |