about summary refs log tree commit diff
path: root/math/libm-test.inc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-24 16:20:48 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-24 16:20:48 +0000
commitac831b362ad6ecd49643625481ec700a9812e52f (patch)
tree1c4c0e14f675e50d079ccf0d1641e8637aee2449 /math/libm-test.inc
parent8475ab16848cf2adb6ce3446749c2f1d10233286 (diff)
downloadglibc-ac831b362ad6ecd49643625481ec700a9812e52f.tar.gz
glibc-ac831b362ad6ecd49643625481ec700a9812e52f.tar.xz
glibc-ac831b362ad6ecd49643625481ec700a9812e52f.zip
Fix csin, csinh overflow in directed rounding modes (bug 18593).
csin and csinh can produce bad results when overflowing in directed
rounding modes, because a multiplication that can overflow is followed
by a possible negation.  This patch fixes this by negating one of the
arguments of the multiplication before the multiplication instead of
negating the result.

The new tests for this issue are added to auto-libm-test-in, starting
use of that file for csin and csinh.  The issue was found in the
course of moving existing tests for csin and csinh (existing tests, by
being enabled in more cases than previously, showed the issue for
float and double but not for long double); that move will now be done
separately.

Tested for x86_64 and x86 and ulps updated accordingly.

	[BZ #18593]
	* math/s_csin.c (__csin): Negate before rather than after possibly
	overflowing multiplication.
	* math/s_csinf.c (__csinf): Likewise.
	* math/s_csinh.c (__csinh): Likewise.
	* math/s_csinhf.c (__csinhf): Likewise.
	* math/s_csinhl.c (__csinhl): Likewise.
	* math/s_csinl.c (__csinl): Likewise.
	* math/auto-libm-test-in: Add some tests of csin and csinh.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (csin_test_data): Use AUTO_TESTS_c_c.
	(csinh_test_data): Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r--math/libm-test.inc4
1 files changed, 4 insertions, 0 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 03c3831389..ba8e8ffb6b 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -6466,6 +6466,8 @@ static const struct test_c_c_data csin_test_data[] =
     TEST_c_c (csin, 0x1p-16434L, 22730, 1.217853148905605987081057582351152052687e4924L, plus_oflow, OVERFLOW_EXCEPTION),
 #endif
 
+    AUTO_TESTS_c_c (csin),
+
     TEST_c_c (csin, min_subnorm_value, min_value, min_subnorm_value, min_value, UNDERFLOW_EXCEPTION),
     TEST_c_c (csin, min_value, min_subnorm_value, min_value, min_subnorm_value, UNDERFLOW_EXCEPTION),
   };
@@ -6563,6 +6565,8 @@ static const struct test_c_c_data csinh_test_data[] =
     TEST_c_c (csinh, 22730, 0x1p-16434L, plus_oflow, 1.217853148905605987081057582351152052687e4924L, OVERFLOW_EXCEPTION),
 #endif
 
+    AUTO_TESTS_c_c (csinh),
+
     TEST_c_c (csinh, min_subnorm_value, min_value, min_subnorm_value, min_value, UNDERFLOW_EXCEPTION),
     TEST_c_c (csinh, min_value, min_subnorm_value, min_value, min_subnorm_value, UNDERFLOW_EXCEPTION),
   };