diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-10-28 01:14:40 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-10-28 01:14:40 +0000 |
commit | e6b29af8a314d3a6a538222a98383c215d410ddf (patch) | |
tree | e34c007df61a87e144b4d34b92e0bfdb14ae5d76 /math | |
parent | ad3371fbac6896adc4820434676f35bd44a24cf8 (diff) | |
download | glibc-e6b29af8a314d3a6a538222a98383c215d410ddf.zip glibc-e6b29af8a314d3a6a538222a98383c215d410ddf.tar.gz glibc-e6b29af8a314d3a6a538222a98383c215d410ddf.tar.bz2 |
[BZ #2549]
2006-04-14 H.J. Lu <hongjiu.lu@intel.com>
[BZ #2549]
* math/libm-test.inc (check_float_internal): Support
denormalized return.
Diffstat (limited to 'math')
-rw-r--r-- | math/libm-test.inc | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index da68d40..e698923 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -487,11 +487,24 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected, else { diff = FUNC(fabs) (computed - expected); - /* ilogb (0) isn't allowed. */ - if (expected == 0.0) - ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG); - else - ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG); + switch (fpclassify (expected)) + { + case FP_ZERO: + /* ilogb (0) isn't allowed. */ + ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG); + break; + case FP_NORMAL: + ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG); + break; + case FP_SUBNORMAL: + ulp = (FUNC(ldexp) (diff, MANT_DIG) + / FUNC(ldexp) (1.0, FUNC(ilogb) (expected))); + break; + default: + /* It should never happen. */ + abort (); + break; + } set_max_error (ulp, curr_max_error); print_diff = 1; if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0 |