From 0a42601f272ea962b200d452a54e0ca374163f60 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 22 Nov 2012 19:56:47 +0000 Subject: Fix ldbl-128ibm atanl spurious underflows (bug 14871). --- sysdeps/ieee754/ldbl-128ibm/s_atanl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sysdeps/ieee754') diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c index 779209d3d7..2a36d16bb4 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c @@ -199,6 +199,22 @@ __atanl (long double x) return atantbl[83]; } + if (k <= 0x3c800000) /* |x| <= 2**-55. */ + { + /* Raise inexact. */ + if (1e300L + x > 0.0) + return x; + } + + if (k >= 0x46c00000) /* |x| >= 2**109. */ + { + /* Saturate result to {-,+}pi/2. */ + if (sign) + return -atantbl[83]; + else + return atantbl[83]; + } + if (sign) x = -x; -- cgit 1.4.1