aboutsummaryrefslogtreecommitdiff
path: root/math/test-misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/test-misc.c')
-rw-r--r--math/test-misc.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/math/test-misc.c b/math/test-misc.c
index ba34f92..5a78574 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -79,6 +79,28 @@ main (void)
}
puts ("ok");
}
+
+ for (i = LDBL_MIN_EXP, x = LDBL_MIN; i >= LDBL_MIN_EXP - LDBL_MANT_DIG + 1;
+ --i, x /= 2.0L)
+ {
+ printf ("2^%d: ", i);
+
+ r = frexpl (x, &e);
+ if (r != 0.5L)
+ {
+ printf ("mantissa incorrect: %.20La\n", r);
+ result = 1;
+ continue;
+ }
+ if (e != i)
+ {
+ printf ("exponent wrong %d (%.20Lg)\n", e, x);
+ result = 1;
+ continue;
+ }
+ puts ("ok");
+ }
+
}
# endif