From 79569444efc685121f65d91f5b4eee834830d416 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 3 Dec 2000 10:00:46 +0000 Subject: Update. 2000-12-03 Ulrich Drepper * math/test-misc.c (main): Add tests for frexp. Reported by Fred J. Tydeman . * sysdeps/i386/fpu/s_frexpl.S: Don't overflow during the computation. --- math/test-misc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'math/test-misc.c') 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 { -- cgit v1.2.3