about summary refs log tree commit diff
path: root/math/test-misc.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-05-03 12:15:04 +0000
committerJakub Jelinek <jakub@redhat.com>2007-05-03 12:15:04 +0000
commit002f0b0b5df92cc1c1302c6b95c0c97fd986ed94 (patch)
tree908b1cf953bdc17ad9a01eed2e7fa7d8aafa1bde /math/test-misc.c
parent57433edee3c08b16967487664a28e0ecc99d7f8c (diff)
downloadglibc-002f0b0b5df92cc1c1302c6b95c0c97fd986ed94.tar.gz
glibc-002f0b0b5df92cc1c1302c6b95c0c97fd986ed94.tar.xz
glibc-002f0b0b5df92cc1c1302c6b95c0c97fd986ed94.zip
* math/test-misc.c (main): Add tests for rounding long double
values close to smallest double denormalized value to double.
	* soft-fp/op-common.h (FP_TRUNC): Correct off-by-one error in
	condition for truncating to 0.  Set sticky bit for such
	truncation.
2007-05-03  Jakub Jelinek  <jakub@redhat.com>

	* math/test-misc.c (main): Add tests for rounding long double
	values close to smallest double denormalized value to double.

2007-04-30  Joseph Myers  <joseph@codesourcery.com>

	* soft-fp/op-common.h (FP_TRUNC): Correct off-by-one error in
	condition for truncating to 0.  Set sticky bit for such
	truncation.
Diffstat (limited to 'math/test-misc.c')
-rw-r--r--math/test-misc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/math/test-misc.c b/math/test-misc.c
index 862e11f0c3..1dc4d909bb 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -1235,5 +1235,22 @@ main (void)
     }
 #endif
 
+#if !defined NO_LONG_DOUBLE && LDBL_MANT_DIG >= DBL_MANT_DIG + 4
+  volatile long double ld5 = nextafter (0.0, 1.0) / 16.0L;
+  volatile double d5;
+  (void) &ld5;
+  int i;
+  for (i = 0; i <= 32; i++)
+    {
+      d5 = ld5 * i;
+      (void) &d5;
+      if (d5 != (i <= 8 ? 0 : i < 24 ? 1 : 2) * nextafter (0.0, 1.0))
+	{
+	  printf ("%La incorrectly rounded to %a\n", ld5 * i, d5);
+	  result = 1;
+	}
+    } 
+#endif
+
   return result;
 }