about summary refs log tree commit diff
path: root/math/test-misc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-12-05 06:36:53 +0000
committerUlrich Drepper <drepper@redhat.com>2000-12-05 06:36:53 +0000
commit6d0c49145e818f4f8417b61ddbe22c957825d5e9 (patch)
tree00927b9a1699f64c19e04832f4219489658b1c40 /math/test-misc.c
parent2aa15430850362f50b069e21598e9acc625d4c27 (diff)
downloadglibc-6d0c49145e818f4f8417b61ddbe22c957825d5e9.tar.gz
glibc-6d0c49145e818f4f8417b61ddbe22c957825d5e9.tar.xz
glibc-6d0c49145e818f4f8417b61ddbe22c957825d5e9.zip
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>
Diffstat (limited to 'math/test-misc.c')
-rw-r--r--math/test-misc.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/math/test-misc.c b/math/test-misc.c
index 098695f73f..514035554c 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;