* 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>
+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.
#include <math.h>
#include <stdio.h>
+#include <string.h>
int
}
}
# 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
{
}
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
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;
#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 */
}
#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);
#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 */
}
fnstsw
andl $0x4500, %eax
cmpl $0x0100, %eax
- je 2f
+ je 3f
fld %st(1)
frndint
fcomp %st(2)
#endif
fldl MO(nan)
ret
+
+ /* The first parameter is a NaN. Return it. */
+3: fstp %st(1)
+ ret
END(__ieee754_scalb)
fnstsw
andl $0x4500, %eax
cmpl $0x0100, %eax
- je 2f
+ je 3f
fld %st(1)
frndint
fcomp %st(2)
#endif
fldl MO(nan)
ret
+
+ /* The first parameter is a NaN. Return it. */
+3: fstp %st(1)
+ ret
END(__ieee754_scalbf)
fnstsw
andl $0x4500, %eax
cmpl $0x0100, %eax
- je 2f
+ je 3f
fld %st(1)
frndint
fcomp %st(2)
#endif
fldl MO(nan)
ret
+
+ /* The first parameter is a NaN. Return it. */
+3: fstp %st(1)
+ ret
END(__ieee754_scalbl)