diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-06-01 19:05:46 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-06-01 19:05:46 +0000 |
commit | c5bfe3d5ba29d36563f1e4bd4f8d7336093ee6fc (patch) | |
tree | f8072090ce6d587aedc58b61b5e719c255aa33f4 | |
parent | 4842e4fe5fcb90312f330b0a98cf73f082aefd01 (diff) | |
download | glibc-c5bfe3d5ba29d36563f1e4bd4f8d7336093ee6fc.tar.gz glibc-c5bfe3d5ba29d36563f1e4bd4f8d7336093ee6fc.tar.xz glibc-c5bfe3d5ba29d36563f1e4bd4f8d7336093ee6fc.zip |
Fix fmod for subnormals (bug 14048).
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | math/libm-test.inc | 8 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c | 4 |
3 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index deb1c0a5c4..a005bd7d42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2012-06-01 Joseph Myers <joseph@codesourcery.com> + [BZ #14048] + * sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c (__ieee754_fmod): + Use int64_t for variable i. + * math/libm-test.inc (fmod_test): Add more tests. + * sysdeps/ieee754/dbl-64/s_fmaf.c (__fmaf): Ensure temp + (double) z computation is not scheduled after fetestexcept. * sysdeps/ieee754/ldbl-128/s_fmal.c: Include <math_private.h>. diff --git a/math/libm-test.inc b/math/libm-test.inc index bb19dee350..2b2ca32536 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -4123,6 +4123,14 @@ fmod_test (void) TEST_ff_f (fmod, 6.5, -2.25L, 2.0L); TEST_ff_f (fmod, -6.5, -2.25L, -2.0L); + TEST_ff_f (fmod, 0x0.fffffep-126L, 0x1p-149L, plus_zero); +#ifndef TEST_FLOAT + TEST_ff_f (fmod, 0x0.fffffffffffffp-1022L, 0x1p-1074L, plus_zero); +#endif +#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 + TEST_ff_f (fmod, 0x0.fffffffffffffffep-16382L, 0x1p-16445L, plus_zero); +#endif + END (fmod); } diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c index 6d2540447f..a630d10fe2 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c @@ -24,8 +24,8 @@ static const double one = 1.0, Zero[] = {0.0, -0.0,}; double __ieee754_fmod (double x, double y) { - int32_t n,i,ix,iy; - int64_t hx,hy,hz,sx; + int32_t n,ix,iy; + int64_t hx,hy,hz,sx,i; EXTRACT_WORDS64(hx,x); EXTRACT_WORDS64(hy,y); |