summaryrefslogtreecommitdiff
path: root/math/s_catanhf.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-04-26 19:26:22 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-04-26 19:26:22 +0000
commit9457fd952cafc701375fc9fae575a4aca1374de3 (patch)
tree0116832c92205eb0c42197ce9c269a7f52d09c5e /math/s_catanhf.c
parentf0302940e7c2acb587971e3c99dfbd00aa4e2134 (diff)
Fix catan, catanh missing underflows (bug 15406).
Diffstat (limited to 'math/s_catanhf.c')
-rw-r--r--math/s_catanhf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/math/s_catanhf.c b/math/s_catanhf.c
index 9d90a00c83..6376a2ccb7 100644
--- a/math/s_catanhf.c
+++ b/math/s_catanhf.c
@@ -20,7 +20,7 @@
#include <complex.h>
#include <math.h>
#include <math_private.h>
-
+#include <float.h>
__complex__ float
__catanhf (__complex__ float x)
@@ -76,6 +76,17 @@ __catanhf (__complex__ float x)
den = 1 - __real__ x * __real__ x - i2;
__imag__ res = 0.5f * __ieee754_atan2f (2.0f * __imag__ x, den);
+
+ if (fabsf (__real__ res) < FLT_MIN)
+ {
+ volatile float force_underflow = __real__ res * __real__ res;
+ (void) force_underflow;
+ }
+ if (fabsf (__imag__ res) < FLT_MIN)
+ {
+ volatile float force_underflow = __imag__ res * __imag__ res;
+ (void) force_underflow;
+ }
}
return res;