about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--NEWS4
-rw-r--r--math/libm-test.inc33
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c2
4 files changed, 34 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 4456bc90d6..74d1a1a48c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2015-02-13  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #17569]
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
+	Compute absolute value of x as modified by fmod, not original
+	value of x.
+	* math/libm-test.inc (RUN_TEST_ffI_f1): Rename to
+	RUN_TEST_ffI_f1_mod8.  Check extra return value mod 8.
+	(RUN_TEST_LOOP_ffI_f1): Rename to RUN_TEST_LOOP_ffI_f1_mod8.  Call
+	RUN_TEST_ffI_f1_mod8.
+	(remquo_test_data): Add more tests.
+
 2015-02-13  Roland McGrath  <roland@hack.frob.com>
 
 	* sysdeps/init_array/pt-crti.S: New file.
diff --git a/NEWS b/NEWS
index b95f5e6d25..89e48c868a 100644
--- a/NEWS
+++ b/NEWS
@@ -9,8 +9,8 @@ Version 2.22
 
 * The following bugs are resolved with this release:
 
-  4719, 15467, 15790, 16560, 17912, 17932, 17944, 17949, 17964, 17965,
-  17967, 17969.
+  4719, 15467, 15790, 16560, 17569, 17912, 17932, 17944, 17949, 17964,
+  17965, 17967, 17969.
 
 Version 2.21
 
diff --git a/math/libm-test.inc b/math/libm-test.inc
index aa7ba2b765..2f3902a445 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1461,9 +1461,9 @@ struct test_fFF_11_data
 		      (ARRAY)[i].RM_##ROUNDING_MODE.extra_test,		\
 		      (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected);	\
   ROUND_RESTORE_ ## ROUNDING_MODE
-#define RUN_TEST_ffI_f1(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED,	\
-			EXCEPTIONS, EXTRA_VAR, EXTRA_TEST,		\
-			EXTRA_EXPECTED)					\
+#define RUN_TEST_ffI_f1_mod8(ARG_STR, FUNC_NAME, ARG1, ARG2, EXPECTED,	\
+			     EXCEPTIONS, EXTRA_VAR, EXTRA_TEST,		\
+			     EXTRA_EXPECTED)				\
   do									\
     if (enable_test (EXCEPTIONS))					\
       {									\
@@ -1474,22 +1474,22 @@ struct test_fFF_11_data
 		     EXPECTED, EXCEPTIONS);				\
 	EXTRA_OUTPUT_TEST_SETUP (ARG_STR, 1);				\
 	if (EXTRA_TEST)							\
-	  check_int (extra1_name, EXTRA_VAR, EXTRA_EXPECTED, 0);	\
+	  check_int (extra1_name, (EXTRA_VAR) % 8, EXTRA_EXPECTED, 0);	\
 	EXTRA_OUTPUT_TEST_CLEANUP (1);					\
 	COMMON_TEST_CLEANUP;						\
       }									\
   while (0)
-#define RUN_TEST_LOOP_ffI_f1(FUNC_NAME, ARRAY, ROUNDING_MODE,		\
-			     EXTRA_VAR)					\
+#define RUN_TEST_LOOP_ffI_f1_mod8(FUNC_NAME, ARRAY, ROUNDING_MODE,	\
+				  EXTRA_VAR)				\
   IF_ROUND_INIT_ ## ROUNDING_MODE					\
     for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++)	\
-      RUN_TEST_ffI_f1 ((ARRAY)[i].arg_str, FUNC_NAME,			\
-		       (ARRAY)[i].arg1, (ARRAY)[i].arg2,		\
-		       (ARRAY)[i].RM_##ROUNDING_MODE.expected,		\
-		       (ARRAY)[i].RM_##ROUNDING_MODE.exceptions,	\
-		       EXTRA_VAR,					\
-		       (ARRAY)[i].RM_##ROUNDING_MODE.extra_test,	\
-		       (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected);	\
+      RUN_TEST_ffI_f1_mod8 ((ARRAY)[i].arg_str, FUNC_NAME,		\
+			    (ARRAY)[i].arg1, (ARRAY)[i].arg2,		\
+			    (ARRAY)[i].RM_##ROUNDING_MODE.expected,	\
+			    (ARRAY)[i].RM_##ROUNDING_MODE.exceptions,	\
+			    EXTRA_VAR,					\
+			    (ARRAY)[i].RM_##ROUNDING_MODE.extra_test,	\
+			    (ARRAY)[i].RM_##ROUNDING_MODE.extra_expected); \
   ROUND_RESTORE_ ## ROUNDING_MODE
 #define RUN_TEST_c_c(ARG_STR, FUNC_NAME, ARGR, ARGC, EXPR, EXPC,	\
 		     EXCEPTIONS)					\
@@ -8759,6 +8759,11 @@ static const struct test_ffI_f1_data remquo_test_data[] =
 
     TEST_ffI_f1 (remquo, 5, 2, 1, 2, NO_INEXACT_EXCEPTION),
     TEST_ffI_f1 (remquo, 3, 2, -1, 2, NO_INEXACT_EXCEPTION),
+
+    TEST_ffI_f1 (remquo, 3419, 360, 179, 1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -3419, 360, -179, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, 3419, -360, 179, -1, NO_INEXACT_EXCEPTION),
+    TEST_ffI_f1 (remquo, -3419, -360, -179, 1, NO_INEXACT_EXCEPTION),
   };
 
 static void
@@ -8766,7 +8771,7 @@ remquo_test (void)
 {
   int x;
 
-  ALL_RM_TEST (remquo, 1, remquo_test_data, RUN_TEST_LOOP_ffI_f1, END, x);
+  ALL_RM_TEST (remquo, 1, remquo_test_data, RUN_TEST_LOOP_ffI_f1_mod8, END, x);
 }
 
 static const struct test_f_f_data rint_test_data[] =
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
index 36fc37c134..5b7142576a 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
@@ -55,7 +55,7 @@ __remquo (double x, double y, int *quo)
       return zero * x;
     }
 
-  INSERT_WORDS64 (x, hx);
+  x = fabs (x);
   INSERT_WORDS64 (y, hy);
   cquo = 0;