about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/e_sinh.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-08-06 23:01:09 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-08-06 23:01:09 +0000
commit5e29dd573777197fc4d12c1bdea8f6d04e505391 (patch)
tree750cd162b91bfad88eaf7904cf33977a248e3817 /sysdeps/ieee754/dbl-64/e_sinh.c
parent2ba30a182ca50ac07f45ed1f813a85ccafaed85d (diff)
downloadglibc-5e29dd573777197fc4d12c1bdea8f6d04e505391.tar.gz
glibc-5e29dd573777197fc4d12c1bdea8f6d04e505391.tar.xz
glibc-5e29dd573777197fc4d12c1bdea8f6d04e505391.zip
Fix sinh missing underflows (bug 16519).
Similar to various other bugs in this area, some sinh implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #16519]
	* sysdeps/ieee754/dbl-64/e_sinh.c: Include <float.h>.
	(__ieee754_sinh): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/flt-32/e_sinhf.c: Include <float.h>.
	(__ieee754_sinhf): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128/e_sinhl.c: Include <float.h>.
	(__ieee754_sinhl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Include <float.h>.
	(__ieee754_sinhl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-96/e_sinhl.c: Include <float.h>.
	(__ieee754_sinhl): Force underflow exception for arguments with
	small absolute value.
	* math/auto-libm-test-in: Add more tests of sinh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/e_sinh.c')
-rw-r--r--sysdeps/ieee754/dbl-64/e_sinh.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_sinh.c b/sysdeps/ieee754/dbl-64/e_sinh.c
index 4ff28bf85d..c99d28311d 100644
--- a/sysdeps/ieee754/dbl-64/e_sinh.c
+++ b/sysdeps/ieee754/dbl-64/e_sinh.c
@@ -32,6 +32,7 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
  *	only sinh(0)=0 is exact for finite x.
  */
 
+#include <float.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -58,10 +59,16 @@ __ieee754_sinh (double x)
   /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
   if (ix < 0x40360000)                  /* |x|<22 */
     {
-      if (__glibc_unlikely (ix < 0x3e300000))              /* |x|<2**-28 */
+      if (__glibc_unlikely (ix < 0x3e300000)) {            /* |x|<2**-28 */
+	if (fabs (x) < DBL_MIN)
+	  {
+	    double force_underflow = x * x;
+	    math_force_eval (force_underflow);
+	  }
 	if (shuge + x > one)
 	  return x;
-      /* sinh(tiny) = tiny with inexact */
+	/* sinh(tiny) = tiny with inexact */
+      }
       t = __expm1 (fabs (x));
       if (ix < 0x3ff00000)
 	return h * (2.0 * t - t * t / (t + one));