mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* math/w_fmod.c: Also handle x=±Inf as error.
* math/w_fmodf.c: Likewise. * math/w_fmodl.c: Likewise. * math/libm-test.inc (fmod_test): Add tests for errno after calls for x=±Inf or y=0.
This commit is contained in:
@ -1,5 +1,11 @@
|
|||||||
2009-04-25 Ulrich Drepper <drepper@redhat.com>
|
2009-04-25 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* math/w_fmod.c: Also handle x=±Inf as error.
|
||||||
|
* math/w_fmodf.c: Likewise.
|
||||||
|
* math/w_fmodl.c: Likewise.
|
||||||
|
* math/libm-test.inc (fmod_test): Add tests for errno after calls for
|
||||||
|
x=±Inf or y=0.
|
||||||
|
|
||||||
* sysdeps/i386/fpu/s_cos.S: Set errno for ±Inf.
|
* sysdeps/i386/fpu/s_cos.S: Set errno for ±Inf.
|
||||||
* sysdeps/i386/fpu/s_cosf.S: Likewise.
|
* sysdeps/i386/fpu/s_cosf.S: Likewise.
|
||||||
* sysdeps/i386/fpu/s_cosl.S: Likewise.
|
* sysdeps/i386/fpu/s_cosl.S: Likewise.
|
||||||
|
@ -2883,11 +2883,17 @@ fmod_test (void)
|
|||||||
TEST_ff_f (fmod, minus_zero, 3, minus_zero);
|
TEST_ff_f (fmod, minus_zero, 3, minus_zero);
|
||||||
|
|
||||||
/* fmod (+inf, y) == NaN plus invalid exception. */
|
/* fmod (+inf, y) == NaN plus invalid exception. */
|
||||||
|
errno = 0;
|
||||||
TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
|
TEST_ff_f (fmod, plus_infty, 3, nan_value, INVALID_EXCEPTION);
|
||||||
|
check_int ("errno for fmod(Inf,3) unchanged", errno, EDOM, 0, 0, 0);
|
||||||
/* fmod (-inf, y) == NaN plus invalid exception. */
|
/* fmod (-inf, y) == NaN plus invalid exception. */
|
||||||
|
errno = 0;
|
||||||
TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
|
TEST_ff_f (fmod, minus_infty, 3, nan_value, INVALID_EXCEPTION);
|
||||||
|
check_int ("errno for fmod(-Inf,3) unchanged", errno, EDOM, 0, 0, 0);
|
||||||
/* fmod (x, +0) == NaN plus invalid exception. */
|
/* fmod (x, +0) == NaN plus invalid exception. */
|
||||||
|
errno = 0;
|
||||||
TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
|
TEST_ff_f (fmod, 3, 0, nan_value, INVALID_EXCEPTION);
|
||||||
|
check_int ("errno for fmod(3,0) unchanged", errno, EDOM, 0, 0, 0);
|
||||||
/* fmod (x, -0) == NaN plus invalid exception. */
|
/* fmod (x, -0) == NaN plus invalid exception. */
|
||||||
TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
|
TEST_ff_f (fmod, 3, minus_zero, nan_value, INVALID_EXCEPTION);
|
||||||
|
|
||||||
|
@ -35,8 +35,9 @@ static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
|
|||||||
double z;
|
double z;
|
||||||
z = __ieee754_fmod(x,y);
|
z = __ieee754_fmod(x,y);
|
||||||
if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
|
if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
|
||||||
if(y==0.0) {
|
if(__isinf(x)||y==0.0) {
|
||||||
return __kernel_standard(x,y,27); /* fmod(x,0) */
|
/* fmod(+-Inf,y) or fmod(x,0) */
|
||||||
|
return __kernel_standard(x,y,27);
|
||||||
} else
|
} else
|
||||||
return z;
|
return z;
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software is freely granted, provided that this notice
|
* software is freely granted, provided that this notice
|
||||||
* is preserved.
|
* is preserved.
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
@ -17,7 +17,7 @@
|
|||||||
static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
|
static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wrapper fmodf(x,y)
|
* wrapper fmodf(x,y)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -38,8 +38,8 @@ static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
|
|||||||
float z;
|
float z;
|
||||||
z = __ieee754_fmodf(x,y);
|
z = __ieee754_fmodf(x,y);
|
||||||
if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
|
if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
|
||||||
if(y==(float)0.0) {
|
if(__isinff(x)||y==(float)0.0) {
|
||||||
/* fmodf(x,0) */
|
/* fmodf(+-Inf,y) or fmodf(x,0) */
|
||||||
return (float)__kernel_standard((double)x,(double)y,127);
|
return (float)__kernel_standard((double)x,(double)y,127);
|
||||||
} else
|
} else
|
||||||
return z;
|
return z;
|
||||||
|
@ -39,8 +39,9 @@ static char rcsid[] = "$NetBSD: $";
|
|||||||
long double z;
|
long double z;
|
||||||
z = __ieee754_fmodl(x,y);
|
z = __ieee754_fmodl(x,y);
|
||||||
if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
|
if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
|
||||||
if(y==0.0) {
|
if(__isinfl(x)||y==0.0) {
|
||||||
return __kernel_standard(x,y,227); /* fmod(x,0) */
|
/* fmodl(+-Inf,y) or fmodl(x,0) */
|
||||||
|
return __kernel_standard(x,y,227);
|
||||||
} else
|
} else
|
||||||
return z;
|
return z;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user