diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2008-04-12 10:53:49 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2008-04-12 10:53:49 +0000 |
commit | 08567827b4d55a05c3afcdadb5ae322089287150 (patch) | |
tree | e67a3610598bd7351d4c4cad020a093f9d41ed25 /libc/math | |
parent | 29888bcfdf080afd1ccbe11b7939b17a9eb5d9bf (diff) |
Merge changes between r5879 and r5900 from /fsf/trunk.
Also:
* sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h: Also test
__NO_FPRS__.
git-svn-id: svn://svn.eglibc.org/trunk@5901 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/math')
-rw-r--r-- | libc/math/libm-test.inc | 43 | ||||
-rw-r--r-- | libc/math/s_significandl.c | 2 |
2 files changed, 44 insertions, 1 deletions
diff --git a/libc/math/libm-test.inc b/libc/math/libm-test.inc index 7b383b414..267d6077e 100644 --- a/libc/math/libm-test.inc +++ b/libc/math/libm-test.inc @@ -4301,6 +4301,17 @@ lround_test (void) # endif TEST_f_l (lround, 2097152.5, 2097153); TEST_f_l (lround, -2097152.5, -2097153); + /* nextafter(0.5,-1) */ + TEST_f_l (lround, 0x1.fffffffffffffp-2, 0); + /* nextafter(-0.5,1) */ + TEST_f_l (lround, -0x1.fffffffffffffp-2, 0); +#else + /* nextafter(0.5,-1) */ + TEST_f_l (lround, 0x1.fffffp-2, 0); + /* nextafter(-0.5,1) */ + TEST_f_l (lround, -0x1.fffffp-2, 0); + TEST_f_l (lround, 0x1.fffffep+23, 16777215); + TEST_f_l (lround, -0x1.fffffep+23, -16777215); #endif END (lround); } @@ -4360,8 +4371,40 @@ llround_test (void) TEST_f_L (llround, 4294967295.5, 4294967296LL); /* 0x200000000 */ TEST_f_L (llround, 8589934591.5, 8589934592LL); + + /* nextafter(0.5,-1) */ + TEST_f_L (llround, 0x1.fffffffffffffp-2, 0); + /* nextafter(-0.5,1) */ + TEST_f_L (llround, -0x1.fffffffffffffp-2, 0); + /* On PowerPC an exponent of '52' is the largest incrementally + * representable sequence of whole-numbers in the 'double' range. We test + * lround to make sure that a guard bit set during the lround operation + * hasn't forced an erroneous shift giving us an incorrect result. The odd + * numbers between +-(2^52+1 and 2^53-1) are affected since they have the + * rightmost bit set. */ + /* +-(2^52+1) */ + TEST_f_L (llround, 0x1.0000000000001p+52,4503599627370497LL); + TEST_f_L (llround, -0x1.0000000000001p+52,-4503599627370497LL); + /* +-(2^53-1): Input is the last (positive and negative) incrementally + * representable whole-number in the 'double' range that might round + * erroneously. */ + TEST_f_L (llround, 0x1.fffffffffffffp+52, 9007199254740991LL); + TEST_f_L (llround, -0x1.fffffffffffffp+52, -9007199254740991LL); +#else + /* nextafter(0.5,-1) */ + TEST_f_L (llround, 0x1.fffffep-2, 0); + /* nextafter(-0.5,1) */ + TEST_f_L (llround, -0x1.fffffep-2, 0); + /* As above, on PowerPC an exponent of '23' is the largest incrementally + * representable sequence of whole-numbers in the 'float' range. + * Likewise, numbers between +-(2^23+1 and 2^24-1) are affected. */ + TEST_f_L (llround, 0x1.000002p+23,8388609); + TEST_f_L (llround, -0x1.000002p+23,-8388609); + TEST_f_L (llround, 0x1.fffffep+23, 16777215); + TEST_f_L (llround, -0x1.fffffep+23, -16777215); #endif + #ifdef TEST_LDOUBLE /* The input can only be represented in long double. */ TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL); diff --git a/libc/math/s_significandl.c b/libc/math/s_significandl.c index 9fa0e4ff9..238b79ae5 100644 --- a/libc/math/s_significandl.c +++ b/libc/math/s_significandl.c @@ -34,6 +34,6 @@ static char rcsid[] = "$NetBSD: $"; long double x; #endif { - return __ieee754_scalbl(x,(long double) -ilogbl(x)); + return __ieee754_scalbl(x,(long double) -__ilogbl(x)); } weak_alias (__significandl, significandl) |