This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add testcase for bug 5794 (incorrect expm1 overflow)


Bug 5794 (incorrect expm1 overflow) was fixed in 2008, but without a
testcase being added to the testsuite.  I propose this patch to add
such a testcase (which I've verified did indeed fail with old glibc).

2012-02-29  Joseph Myers  <joseph@codesourcery.com>

	* math/libm-test.inc (expm1_test): Add test for bug 5794.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 1016753..be54e79 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -2602,6 +2602,10 @@ expm1_test (void)
   TEST_f_f (expm1, 1, M_El - 1.0);
   TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
 
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_f_f (expm1, 11356.25L, 9.05128237311923300051376115753226014206e+4931L);
+#endif
+
   errno = 0;
   TEST_f_f (expm1, 100000.0, plus_infty);
   check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0);
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 83a68af..42a8998 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -456,6 +456,8 @@ ldouble: 8
 # expm1
 Test "expm1 (1) == M_El - 1.0":
 ildouble: 1
+Test "expm1 (11356.25) == 9.05128237311923300051376115753226014206e+4931":
+ldouble: 1
 
 # gamma
 Test "gamma (-0.5) == log(2*sqrt(pi))":
@@ -1184,6 +1186,7 @@ ldouble: 8
 
 Function: "expm1":
 ildouble: 1
+ldouble: 1
 
 Function: "gamma":
 double: 1
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index a2a82e6..093dbf8 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -511,6 +511,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "expm1 (11356.25) == 9.05128237311923300051376115753226014206e+4931":
+ildouble: 1
+ldouble: 1
 
 # gamma
 Test "gamma (-0.5) == log(2*sqrt(pi))":
@@ -1265,6 +1268,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "gamma":
 ildouble: 1

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]