diff options
author | Kevin Ryde <user42@zip.com.au> | 2003-07-14 00:11:56 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2003-07-14 00:11:56 +0200 |
commit | bb38722a0c2b512ba9ffc90840a5f68f64cc1122 (patch) | |
tree | 903fc98d61677c1512be7b37f85bad71c38f9578 /tests/misc.c | |
parent | d70b3b3d515864f0e7945599752c76e766e5d136 (diff) | |
download | gmp-bb38722a0c2b512ba9ffc90840a5f68f64cc1122.tar.gz |
* tests/misc.c, tests/tests.h (tests_isinf): New function.
Diffstat (limited to 'tests/misc.c')
-rw-r--r-- | tests/misc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/misc.c b/tests/misc.c index 55d8153e3..7115f18fe 100644 --- a/tests/misc.c +++ b/tests/misc.c @@ -430,6 +430,21 @@ tests_infinity_d (void) } +/* Return non-zero if d is an infinity (either positive or negative). + Don't want libm, so don't use isinf() or other system tests. */ +int +tests_isinf (double d) +{ +#if _GMP_IEEE_FLOATS + union ieee_double_extract x; + x.d = d; + return (x.s.exp == 2047 && x.s.manl == 0 && x.s.manh == 0); +#else + return 0; +#endif +} + + /* Set the hardware floating point rounding mode. Same mode values as mpfr, namely 0=nearest, 1=tozero, 2=up, 3=down. Return 1 if successful, 0 if not. */ |