aboutsummaryrefslogtreecommitdiff
path: root/math/s_ctanhl.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-09-15 17:46:08 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-09-15 17:46:08 +0000
commit0b87419b690d1711697ed95808527400910ff997 (patch)
tree95c2f39d1c562fc25437dfb20faefbb097e094ef /math/s_ctanhl.c
parent694aabefd2eb3a0e2c5624d7feb1d7310b2bdd8b (diff)
downloadglibc-0b87419b690d1711697ed95808527400910ff997.zip
glibc-0b87419b690d1711697ed95808527400910ff997.tar.gz
glibc-0b87419b690d1711697ed95808527400910ff997.tar.bz2
Fix ctan, ctanh missing underflows (bug 18595).
Similar to various other bugs in this area, ctan and ctanh can fail to raise the underflow exception for some cases of results that are tiny and inexact. This patch forces the exception in a similar way to previous fixes. Tested for x86_64 and x86. [BZ #18595] * math/s_ctan.c (__ctan): Force underflow exception for results whose real or imaginary part has small absolute value. * 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: Do not allow missing underflow for ctan and ctanh. Add more tests of ctan and ctanh.
Diffstat (limited to 'math/s_ctanhl.c')
-rw-r--r--math/s_ctanhl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c
index 6b9dfc5..9c15bb3 100644
--- a/math/s_ctanhl.c
+++ b/math/s_ctanhl.c
@@ -117,6 +117,16 @@ __ctanhl (__complex__ long double x)
__real__ res = sinhrx * coshrx / den;
__imag__ res = sinix * cosix / den;
}
+ if (fabsl (__real__ res) < LDBL_MIN)
+ {
+ long double force_underflow = __real__ res * __real__ res;
+ math_force_eval (force_underflow);
+ }
+ if (fabsl (__imag__ res) < LDBL_MIN)
+ {
+ long double force_underflow = __imag__ res * __imag__ res;
+ math_force_eval (force_underflow);
+ }
}
return res;