summaryrefslogtreecommitdiff
path: root/math/test-misc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-12-03 10:00:46 +0000
committerUlrich Drepper <drepper@redhat.com>2000-12-03 10:00:46 +0000
commit79569444efc685121f65d91f5b4eee834830d416 (patch)
tree05e776a4edd548651a6eca18eef62983c5ca7475 /math/test-misc.c
parent06f55c0c1d28a6ef1462c54a94988112070a0c50 (diff)
Update.
2000-12-03 Ulrich Drepper <drepper@redhat.com> * math/test-misc.c (main): Add tests for frexp. Reported by Fred J. Tydeman <tydeman@tybor.com>. * sysdeps/i386/fpu/s_frexpl.S: Don't overflow during the computation.
Diffstat (limited to 'math/test-misc.c')
-rw-r--r--math/test-misc.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/math/test-misc.c b/math/test-misc.c
index 515277f5ad..c0b8d0ff77 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -39,6 +39,43 @@ main (void)
result = 1;
}
}
+
+# if __GNUC__ >= 3 || __GNUC_MINOR__ >= 96
+ {
+ long double x = LDBL_MAX / ldexpl (1.0L, LDBL_MANT_DIG + 1);
+ long double m;
+ int i;
+
+# if LDBL_MANT_DIG == 64
+ m = 0xf.fffffffffffffffp-4L;
+# else
+# error "Please adjust"
+# endif
+
+ for (i = 0; i < LDBL_MANT_DIG + 1; ++i, x *= 2.0L)
+ {
+ long double r;
+ int e;
+
+ printf ("2^%d: ", LDBL_MAX_EXP - (LDBL_MANT_DIG + 1) + i);
+
+ r = frexpl (x, &e);
+ if (r != m)
+ {
+ printf ("mantissa incorrect: %.20La\n", r);
+ result = 1;
+ continue;
+ }
+ if (e != LDBL_MAX_EXP - (LDBL_MANT_DIG + 1) + i)
+ {
+ printf ("exponent wrong %d (%.20Lg)\n", e, x);
+ result = 1;
+ continue;
+ }
+ puts ("ok");
+ }
+ }
+# endif
#endif
{