diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-12-05 06:36:53 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-12-05 06:36:53 +0000 |
commit | 6d0c49145e818f4f8417b61ddbe22c957825d5e9 (patch) | |
tree | 00927b9a1699f64c19e04832f4219489658b1c40 | |
parent | 2aa15430850362f50b069e21598e9acc625d4c27 (diff) | |
download | glibc-6d0c49145e818f4f8417b61ddbe22c957825d5e9.zip glibc-6d0c49145e818f4f8417b61ddbe22c957825d5e9.tar.gz glibc-6d0c49145e818f4f8417b61ddbe22c957825d5e9.tar.bz2 |
Update.
* sysdeps/i386/fpu/e_scalb.S: Handle NaN as first parameter correctly.
* sysdeps/i386/fpu/e_scalbf.S: Likewise.
* sysdeps/i386/fpu/e_scalbl.S: Likewise.
* math/w_scalb.c: Don't use matherr except in SVID mode.
* math/w_scalbf.c: Likewise.
* math/w_scalbl.c: Likewise.
* math/test-misc.c: Add test for NaN and scalbl.
Reported by Fred J. Tydeman <tydeman@tybor.com>.
2000-12-04 Ulrich Drepper <drepper@redhat.com>
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | math/test-misc.c | 49 | ||||
-rw-r--r-- | math/w_scalb.c | 2 | ||||
-rw-r--r-- | math/w_scalbf.c | 2 | ||||
-rw-r--r-- | math/w_scalbl.c | 2 | ||||
-rw-r--r-- | sysdeps/i386/fpu/e_scalb.S | 6 | ||||
-rw-r--r-- | sysdeps/i386/fpu/e_scalbf.S | 6 | ||||
-rw-r--r-- | sysdeps/i386/fpu/e_scalbl.S | 6 |
8 files changed, 76 insertions, 8 deletions
@@ -1,5 +1,16 @@ 2000-12-04 Ulrich Drepper <drepper@redhat.com> + * sysdeps/i386/fpu/e_scalb.S: Handle NaN as first parameter correctly. + * sysdeps/i386/fpu/e_scalbf.S: Likewise. + * sysdeps/i386/fpu/e_scalbl.S: Likewise. + * math/w_scalb.c: Don't use matherr except in SVID mode. + * math/w_scalbf.c: Likewise. + * math/w_scalbl.c: Likewise. + * math/test-misc.c: Add test for NaN and scalbl. + Reported by Fred J. Tydeman <tydeman@tybor.com>. + +2000-12-04 Ulrich Drepper <drepper@redhat.com> + * configure.in: Define HAVE_ASM_GLOBAL_DOT_NAME for AIX. * config.h.in: Add HAVE_ASM_GLOBAL_DOT_NAME. * include/libc-symbols.h (strong_alias): Define special version diff --git a/math/test-misc.c b/math/test-misc.c index 098695f..5140355 100644 --- a/math/test-misc.c +++ b/math/test-misc.c @@ -19,6 +19,7 @@ #include <math.h> #include <stdio.h> +#include <string.h> int @@ -75,6 +76,26 @@ main (void) } } # endif + +#if 0 + { + int e; + long double r = frexpl (LDBL_MIN * LDBL_EPSILON, &e); + + if (r != 0.5) + { + printf ("frexpl (LDBL_MIN * LDBL_EPSILON, ...): mantissa wrong: %Lg\n", + r); + result = 1; + } + else if (e != -16444) + { + printf ("frexpl (LDBL_MIN * LDBL_EPSILON, ...): exponent wrong: %d\n", + e); + result = 1; + } + } +#endif #endif { @@ -120,8 +141,9 @@ main (void) } if (fpclassify (nextafterl (LDBL_MIN, LDBL_MIN / 2.0)) != FP_SUBNORMAL) { - printf ("fpclassify (LDBL_MIN-epsilon) failed: %d\n", - fpclassify (nextafterl (LDBL_MIN, LDBL_MIN / 2.0))); + printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%Lg)\n", + fpclassify (nextafterl (LDBL_MIN, LDBL_MIN / 2.0)), + nextafterl (LDBL_MIN, LDBL_MIN / 2.0)); result = 1; } #endif @@ -161,6 +183,29 @@ main (void) result = 1; } } + + /* Special NaNs in x86 long double. Test for scalbl. */ + { + union + { + char b[10]; + long double d; + } u = + { .b = { 0, 1, 0, 0, 0, 0, 0, 0xc0, 0xff, 0x7f } }; + long double r; + + r = scalbl (u.d, 0.0); + if (!isnan (r)) + { + puts ("scalbl(NaN, 0) does not return NaN"); + result = 1; + } + else if (memcmp (&r, &u.d, sizeof (double)) != 0) + { + puts ("scalbl(NaN, 0) does not return the same NaN"); + result = 1; + } + } #endif return result; diff --git a/math/w_scalb.c b/math/w_scalb.c index e5c407a..c981b85 100644 --- a/math/w_scalb.c +++ b/math/w_scalb.c @@ -45,7 +45,7 @@ static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $"; #else double z; z = __ieee754_scalb(x,fn); - if(_LIB_VERSION == _IEEE_) return z; + if(_LIB_VERSION != _SVID_) return z; if(!(__finite(z)||__isnan(z))&&__finite(x)) { return __kernel_standard(x,(double)fn,32); /* scalb overflow */ } diff --git a/math/w_scalbf.c b/math/w_scalbf.c index 488a717..5105608 100644 --- a/math/w_scalbf.c +++ b/math/w_scalbf.c @@ -48,7 +48,7 @@ static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $"; #else float z; z = __ieee754_scalbf(x,fn); - if(_LIB_VERSION == _IEEE_) return z; + if(_LIB_VERSION != _SVID_) return z; if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) { /* scalbf overflow */ return (float)__kernel_standard((double)x,(double)fn,132); diff --git a/math/w_scalbl.c b/math/w_scalbl.c index 3ca8d96..6a7d307 100644 --- a/math/w_scalbl.c +++ b/math/w_scalbl.c @@ -49,7 +49,7 @@ static char rcsid[] = "$NetBSD: $"; #else long double z; z = __ieee754_scalbl(x,fn); - if(_LIB_VERSION == _IEEE_) return z; + if(_LIB_VERSION != _SVID_) return z; if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) { return __kernel_standard(x,(double)fn,232); /* scalb overflow */ } diff --git a/sysdeps/i386/fpu/e_scalb.S b/sysdeps/i386/fpu/e_scalb.S index 7ff5541..f463002 100644 --- a/sysdeps/i386/fpu/e_scalb.S +++ b/sysdeps/i386/fpu/e_scalb.S @@ -50,7 +50,7 @@ ENTRY(__ieee754_scalb) fnstsw andl $0x4500, %eax cmpl $0x0100, %eax - je 2f + je 3f fld %st(1) frndint fcomp %st(2) @@ -91,4 +91,8 @@ ENTRY(__ieee754_scalb) #endif fldl MO(nan) ret + + /* The first parameter is a NaN. Return it. */ +3: fstp %st(1) + ret END(__ieee754_scalb) diff --git a/sysdeps/i386/fpu/e_scalbf.S b/sysdeps/i386/fpu/e_scalbf.S index 4222eec..4b5b0d0 100644 --- a/sysdeps/i386/fpu/e_scalbf.S +++ b/sysdeps/i386/fpu/e_scalbf.S @@ -52,7 +52,7 @@ ENTRY(__ieee754_scalbf) fnstsw andl $0x4500, %eax cmpl $0x0100, %eax - je 2f + je 3f fld %st(1) frndint fcomp %st(2) @@ -93,4 +93,8 @@ ENTRY(__ieee754_scalbf) #endif fldl MO(nan) ret + + /* The first parameter is a NaN. Return it. */ +3: fstp %st(1) + ret END(__ieee754_scalbf) diff --git a/sysdeps/i386/fpu/e_scalbl.S b/sysdeps/i386/fpu/e_scalbl.S index 56cc833..e8166fa 100644 --- a/sysdeps/i386/fpu/e_scalbl.S +++ b/sysdeps/i386/fpu/e_scalbl.S @@ -52,7 +52,7 @@ ENTRY(__ieee754_scalbl) fnstsw andl $0x4500, %eax cmpl $0x0100, %eax - je 2f + je 3f fld %st(1) frndint fcomp %st(2) @@ -93,4 +93,8 @@ ENTRY(__ieee754_scalbl) #endif fldl MO(nan) ret + + /* The first parameter is a NaN. Return it. */ +3: fstp %st(1) + ret END(__ieee754_scalbl) |