Fix fmod for subnormals (bug 14048).

This commit is contained in:
Joseph Myers 2012-06-01 19:05:46 +00:00
parent 4842e4fe5f
commit c5bfe3d5ba
3 changed files with 15 additions and 2 deletions

View File

@ -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>.

View File

@ -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);
}

View File

@ -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);