From c5bfe3d5ba29d36563f1e4bd4f8d7336093ee6fc Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 1 Jun 2012 19:05:46 +0000 Subject: [PATCH] Fix fmod for subnormals (bug 14048). --- ChangeLog | 5 +++++ math/libm-test.inc | 8 ++++++++ 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 + [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 . 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); -- 2.43.5