about summary refs log tree commit diff
path: root/math/auto-libm-test-in
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-24 21:04:51 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-24 21:04:51 +0000
commita67894c505d44c3a5292804c37d318684d2be469 (patch)
treeefd103776ffd4c9502fe2a1ae20dabde832d291b /math/auto-libm-test-in
parent010186901d16060a5d1178cc0f2f59199228b99a (diff)
downloadglibc-a67894c505d44c3a5292804c37d318684d2be469.tar.gz
glibc-a67894c505d44c3a5292804c37d318684d2be469.tar.xz
glibc-a67894c505d44c3a5292804c37d318684d2be469.zip
Fix cexp, ccos, ccosh, csin, csinh spurious underflows (bug 18594).
cexp, ccos, ccosh, csin and csinh have spurious underflows in cases
where they compute sin of the smallest normal, that produces an
underflow exception (depending on which sin implementation is in use)
but the final result does not underflow.  ctan and ctanh may also have
such underflows, or they may be latent (the issue there is that
e.g. ctan (DBL_MIN) should, rounded upwards, be the next double value
above DBL_MIN, which under glibc's accuracy goals may not have an
underflow exception, but the intermediate computation of sin (DBL_MIN)
would legitimately underflow on before-rounding architectures).

This patch fixes all those functions so they use plain comparisons (>
DBL_MIN etc.) instead of comparing the result of fpclassify with
FP_SUBNORMAL (in all these cases, we already know the number being
compared is finite).  Note that in the case of csin / csinf / csinl,
there is no need for fabs calls in the comparison because the real
part has already been reduced to its absolute value.

As the patch fixes the failures that previously obstructed moving
tests of cexp to use ALL_RM_TEST, those tests are moved to ALL_RM_TEST
by the patch (two functions remain yet to be converted).

Tested for x86_64 and x86 and ulps updated accordingly.

	[BZ #18594]
	* math/s_ccosh.c (__ccosh): Compare with least normal value
	instead of comparing class with FP_SUBNORMAL.
	* math/s_ccoshf.c (__ccoshf): Likewise.
	* math/s_ccoshl.c (__ccoshl): Likewise.
	* math/s_cexp.c (__cexp): Likewise.
	* math/s_cexpf.c (__cexpf): Likewise.
	* math/s_cexpl.c (__cexpl): Likewise.
	* math/s_csin.c (__csin): Likewise.
	* 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/s_ctan.c (__ctan): Likewise.
	* math/s_ctanf.c (__ctanf): Likewise.
	* math/s_ctanh.c (__ctanh): Likewise.
	* math/s_ctanhf.c (__ctanhf): Likewise.
	* math/s_ctanhl.c (__ctanhl): Likewise.
	* math/s_ctanl.c (__ctanl): Likewise.
	* math/auto-libm-test-in: Add more tests of ccos, ccosh, cexp,
	csin, csinh, ctan and ctanh.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (cexp_test): Use ALL_RM_TEST.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Diffstat (limited to 'math/auto-libm-test-in')
-rw-r--r--math/auto-libm-test-in37
1 files changed, 37 insertions, 0 deletions
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 89a2684598..75cf545a86 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -496,6 +496,11 @@ ccos 0x1p-16434 22730
 ccos min_subnorm_p120 0x1p-120
 ccos 0x1p-120 min_subnorm_p120
 
+ccos min 1
+ccos -min 1
+ccos min_subnorm 80
+ccos -min_subnorm 80
+
 ccosh 0.0 0.0
 ccosh -0 0.0
 ccosh 0.0 -0
@@ -524,6 +529,11 @@ ccosh 22730 0x1p-16434
 ccosh min_subnorm_p120 0x1p-120
 ccosh 0x1p-120 min_subnorm_p120
 
+ccosh 1 min
+ccosh 1 -min
+ccosh 80 min_subnorm
+ccosh 80 -min_subnorm
+
 cexp 0 0
 cexp -0 0
 cexp 0 -0
@@ -558,6 +568,11 @@ cexp 1e6 0
 cexp 1e6 min
 cexp 1e6 -min
 
+cexp 1 min
+cexp 1 -min
+cexp 80 min_subnorm
+cexp 80 -min_subnorm
+
 cexp min min_subnorm
 cexp min -min_subnorm
 
@@ -985,6 +1000,11 @@ csin 0x1p-149 180
 csin 0x1p-1074 1440
 csin 0x1p-16434 22730
 
+csin min 1
+csin -min 1
+csin min_subnorm 80
+csin -min_subnorm 80
+
 csinh 0.0 0.0
 csinh -0 0.0
 csinh 0.0 -0
@@ -1015,6 +1035,11 @@ csinh 180 0x1p-149
 csinh 1440 0x1p-1074
 csinh 22730 0x1p-16434
 
+csinh 1 min
+csinh 1 -min
+csinh 80 min_subnorm
+csinh 80 -min_subnorm
+
 csqrt 0 0
 csqrt 0 -0
 csqrt -0 0
@@ -1132,6 +1157,12 @@ ctan 0x1.921fb6p+0 0x1p-149
 ctan 0x1.921fb54442d18p+0 0x1p-1074
 ctan 0x1.921fb54442d1846ap+0 0x1p-16445
 
+# Bug 18595: underflow exception may be missing
+ctan min 0 missing-underflow
+ctan -min 0 missing-underflow
+ctan min_subnorm 0 missing-underflow
+ctan -min_subnorm 0 missing-underflow
+
 ctanh 0 0
 ctanh 0 -0
 ctanh -0 0
@@ -1166,6 +1197,12 @@ ctanh 0x1p-149 0x1.921fb6p+0
 ctanh 0x1p-1074 0x1.921fb54442d18p+0
 ctanh 0x1p-16445 0x1.921fb54442d1846ap+0
 
+# Bug 18595: underflow exception may be missing
+ctanh 0 min missing-underflow
+ctanh 0 -min missing-underflow
+ctanh 0 min_subnorm missing-underflow
+ctanh 0 -min_subnorm missing-underflow
+
 erf 0
 erf -0
 erf 0.125