aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--NEWS6
-rw-r--r--math/libm-test.inc18
-rw-r--r--math/w_remainder.c4
-rw-r--r--math/w_remainderf.c8
-rw-r--r--math/w_remainderl.c4
6 files changed, 38 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 4288477..3917692 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-09-29 Andreas Jaeger <aj@suse.de>
+
+ [BZ #6779]
+ [BZ #6783]
+ * math/w_remainderl.c (__remainderl): Handle (NaN, 0) and (Inf,y)
+ correctly.
+ * math/w_remainder.c (__remainder): Likewise.
+ * math/w_remainderf.c (__remainderf): Likewise.
+ * math/libm-test.inc (remainder_test): Add test cases.
+
2011-10-04 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* stdlib/longlong.h: Update from GCC. Fix zarch smul_ppmm and
diff --git a/NEWS b/NEWS
index 73552e6..87649a8 100644
--- a/NEWS
+++ b/NEWS
@@ -9,9 +9,9 @@ Version 2.15
* The following bugs are resolved with this release:
- 9696, 11589, 12403, 12847, 12868, 12852, 12874, 12885, 12907, 12922,
- 12935, 13007, 13021, 13067, 13068, 13090, 13092, 13114, 13118, 13123,
- 13134, 13138, 13150
+ 6779, 6783, 9696, 11589, 12403, 12847, 12868, 12852, 12874, 12885, 12907,
+ 12922, 12935, 13007, 13021, 13067, 13068, 13090, 13092, 13114, 13118,
+ 13123, 13134, 13138, 13150
* New program pldd to list loaded object of a process
Implemented by Ulrich Drepper.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 70d936c..96da7cd 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -189,7 +189,7 @@ static FLOAT max_error, real_max_error, imag_max_error;
#define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
- (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
+ (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
static void
init_max_error (void)
@@ -4940,11 +4940,27 @@ remainder_test (void)
START (remainder);
+ errno = 0;
TEST_ff_f (remainder, 1, 0, nan_value, INVALID_EXCEPTION);
+ check_int ("errno for remainder(1, 0) = EDOM ", errno, EDOM, 0, 0, 0);
+ errno = 0;
TEST_ff_f (remainder, 1, minus_zero, nan_value, INVALID_EXCEPTION);
+ check_int ("errno for remainder(1, -0) = EDOM ", errno, EDOM, 0, 0, 0);
+ errno = 0;
TEST_ff_f (remainder, plus_infty, 1, nan_value, INVALID_EXCEPTION);
+ check_int ("errno for remainder(INF, 1) = EDOM ", errno, EDOM, 0, 0, 0);
+ errno = 0;
TEST_ff_f (remainder, minus_infty, 1, nan_value, INVALID_EXCEPTION);
+ check_int ("errno for remainder(-INF, 1) = EDOM ", errno, EDOM, 0, 0, 0);
+ errno = 0;
TEST_ff_f (remainder, nan_value, nan_value, nan_value);
+ check_int ("errno for remainder(NAN, NAN) unchanged", errno, 0, 0, 0, 0);
+ errno = 0;
+ TEST_ff_f (remainder, 0, nan_value, nan_value);
+ check_int ("errno for remainder(0, NAN) unchanged", errno, 0, 0, 0, 0);
+ errno = 0;
+ TEST_ff_f (remainder, nan_value, 0, nan_value);
+ check_int ("errno for remainder(NaN, 0) unchanged", errno, 0, 0, 0, 0);
TEST_ff_f (remainder, 1.625, 1.0, -0.375);
TEST_ff_f (remainder, -1.625, 1.0, 0.375);
diff --git a/math/w_remainder.c b/math/w_remainder.c
index 9d7a7c5..9ff53e3 100644
--- a/math/w_remainder.c
+++ b/math/w_remainder.c
@@ -33,8 +33,8 @@ static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp
#else
double z;
z = __ieee754_remainder(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z;
- if(y==0.0)
+ if(_LIB_VERSION == _IEEE_ || __isnan(y) || __isnan(x)) return z;
+ if(y==0.0 || __isinf(x))
return __kernel_standard(x,y,28); /* remainder(x,0) */
else
return z;
diff --git a/math/w_remainderf.c b/math/w_remainderf.c
index 486e626..ab1ea2d 100644
--- a/math/w_remainderf.c
+++ b/math/w_remainderf.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* 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.
* ====================================================
*/
@@ -17,7 +17,7 @@
static char rcsid[] = "$NetBSD: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp $";
#endif
-/*
+/*
* wrapper remainderf(x,p)
*/
@@ -36,8 +36,8 @@ static char rcsid[] = "$NetBSD: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp
#else
float z;
z = __ieee754_remainderf(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnanf(y)) return z;
- if(y==(float)0.0)
+ if(_LIB_VERSION == _IEEE_ || __isnanf(y) || __isnanf(x)) return z;
+ if(y==(float)0.0 || __isinff(x))
/* remainder(x,0) */
return (float)__kernel_standard((double)x,(double)y,128);
else
diff --git a/math/w_remainderl.c b/math/w_remainderl.c
index 7635fb9..e5460cd 100644
--- a/math/w_remainderl.c
+++ b/math/w_remainderl.c
@@ -38,8 +38,8 @@ static char rcsid[] = "$NetBSD: $";
#else
long double z;
z = __ieee754_remainderl(x,y);
- if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z;
- if(y==0.0)
+ if(_LIB_VERSION == _IEEE_ || __isnanl(y) || __isnanl(x)) return z;
+ if(y==0.0 || __isinfl(x))
return __kernel_standard(x,y,228); /* remainder(x,0) */
else
return z;