about summary refs log tree commit diff
path: root/math/libm-test.inc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-04-02 17:41:02 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-04-02 17:41:02 +0000
commita84e78c8b3c4de94b488fdc5321f71feeb99358f (patch)
treeb4e8a63fd2eb10f4598a5af855e6462a9b06767e /math/libm-test.inc
parent6f05bafebac30a389807979f8efbb709f84b486f (diff)
downloadglibc-a84e78c8b3c4de94b488fdc5321f71feeb99358f.tar.gz
glibc-a84e78c8b3c4de94b488fdc5321f71feeb99358f.tar.xz
glibc-a84e78c8b3c4de94b488fdc5321f71feeb99358f.zip
Fix catan, catanh, __ieee754_logf in round-downward mode (bug 16799, bug 16800).
This patch fixes incorrect results from catan and catanh of certain
special inputs in round-downward mode (bug 16799), and incorrect
results of __ieee754_logf (+/-0) in round-downward mode (bug 16800)
that show up through catan/catanh when tested in all rounding modes,
but not directly in the testing for logf because the bug gets hidden
by the wrappers.

Both bugs involve a zero that should be +0 being -0 instead: one
computed as (1-x)*(1+x) in the catan/catanh case, and one as (x-x) in
the logf case.  The fixes ensure positive zero is used.  Testing of
catan and catanh in all rounding modes is duly enabled.

I expect there are various other bugs in special cases in __ieee754_*
functions that are normally hidden by the wrappers but would show up
for testing with -lieee (or in future with -fno-math-errno if we
replace -lieee and _LIB_VERSION with compile-time redirection to new
*_noerrno symbol names).

Tested x86_64 and x86 and ulps updated accordingly.

	[BZ #16799]
	[BZ #16800]
	* math/s_catan.c (__catan): Avoid passing -0 denominator to atan2
	with 0 numerator.
	* math/s_catanf.c (__catanf): Likewise.
	* math/s_catanh.c (__catanh): Likewise.
	* math/s_catanhf.c (__catanhf): Likewise.
	* math/s_catanhl.c (__catanhl): Likewise.
	* math/s_catanl.c (__catanl): Likewise.
	* sysdeps/ieee754/flt-32/e_logf.c (__ieee754_logf): Always divide
	by positive zero when computing -Inf result.
	* math/libm-test.inc (catan_test): Use ALL_RM_TEST.
	(catanh_test): Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r--math/libm-test.inc8
1 files changed, 2 insertions, 6 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index c6279e75a9..5e6789f9fb 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -5239,9 +5239,7 @@ static const struct test_c_c_data catan_test_data[] =
 static void
 catan_test (void)
 {
-  START (catan, 0);
-  RUN_TEST_LOOP_c_c (catan, catan_test_data, );
-  END_COMPLEX;
+  ALL_RM_TEST (catan, 0, catan_test_data, RUN_TEST_LOOP_c_c, END_COMPLEX);
 }
 
 static const struct test_c_c_data catanh_test_data[] =
@@ -5746,9 +5744,7 @@ static const struct test_c_c_data catanh_test_data[] =
 static void
 catanh_test (void)
 {
-  START (catanh, 0);
-  RUN_TEST_LOOP_c_c (catanh, catanh_test_data, );
-  END_COMPLEX;
+  ALL_RM_TEST (catanh, 0, catanh_test_data, RUN_TEST_LOOP_c_c, END_COMPLEX);
 }
 
 static const struct test_f_f_data cbrt_test_data[] =