summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-96')
-rw-r--r--sysdeps/ieee754/ldbl-96/e_coshl.c9
-rw-r--r--sysdeps/ieee754/ldbl-96/s_ilogbl.c11
-rw-r--r--sysdeps/ieee754/ldbl-96/s_llroundl.c12
3 files changed, 18 insertions, 14 deletions
diff --git a/sysdeps/ieee754/ldbl-96/e_coshl.c b/sysdeps/ieee754/ldbl-96/e_coshl.c
index 6af846cb2d..8c38fa4da2 100644
--- a/sysdeps/ieee754/ldbl-96/e_coshl.c
+++ b/sysdeps/ieee754/ldbl-96/e_coshl.c
@@ -79,16 +79,15 @@ static long double one = 1.0, half=0.5, huge = 1.0e4900L;
 	if (ex < 0x400c || (ex == 0x400c && mx < 0xb1700000u))
 		return half*__ieee754_expl(fabsl(x));
 
-    /* |x| in [log(maxdouble), overflowthresold] */
-	if (ex < 0x400d
-	    || (ex == 0x400d && (mx < 0xb170b513u
-				  || (mx == 0xb170b513u && lx < 0xa1dfd60cu))))
+    /* |x| in [log(maxdouble), log(2*maxdouble)) */
+	if (ex == 0x400c && (mx < 0xb174ddc0u
+			     || (mx == 0xb174ddc0u && lx < 0x31aec0ebu)))
 	{
 	    w = __ieee754_expl(half*fabsl(x));
 	    t = half*w;
 	    return t*w;
 	}
 
-    /* |x| > overflowthresold, cosh(x) overflow */
+    /* |x| >= log(2*maxdouble), cosh(x) overflow */
 	return huge*huge;
 }
diff --git a/sysdeps/ieee754/ldbl-96/s_ilogbl.c b/sysdeps/ieee754/ldbl-96/s_ilogbl.c
index d44229dcda..9688f5af8f 100644
--- a/sysdeps/ieee754/ldbl-96/s_ilogbl.c
+++ b/sysdeps/ieee754/ldbl-96/s_ilogbl.c
@@ -20,10 +20,12 @@ static char rcsid[] = "$NetBSD: $";
 
 /* ilogbl(long double x)
  * return the binary exponent of non-zero x
- * ilogbl(0) = 0x80000001
- * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised)
+ * ilogbl(0) = FP_ILOGB0
+ * ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
+ * ilogbl(+-Inf) = INT_MAX (no signal is raised)
  */
 
+#include <limits.h>
 #include "math.h"
 #include "math_private.h"
 
@@ -51,6 +53,9 @@ static char rcsid[] = "$NetBSD: $";
 	    return ix;
 	}
 	else if (es<0x7fff) return es-0x3fff;
-	else return FP_ILOGBNAN;
+	else if (FP_ILOGBNAN != INT_MAX && (hx|lx) == 0)
+	    /* ISO C99 requires ilogbl(+-Inf) == INT_MAX.  */
+	    return INT_MAX;
+	return FP_ILOGBNAN;
 }
 weak_alias (__ilogbl, ilogbl)
diff --git a/sysdeps/ieee754/ldbl-96/s_llroundl.c b/sysdeps/ieee754/ldbl-96/s_llroundl.c
index 4a537c871e..61df42d3c2 100644
--- a/sysdeps/ieee754/ldbl-96/s_llroundl.c
+++ b/sysdeps/ieee754/ldbl-96/s_llroundl.c
@@ -1,5 +1,5 @@
 /* Round long double value to long long int.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -59,13 +59,13 @@ __llroundl (long double x)
       else
 	{
 	  u_int32_t j = i1 + (0x80000000 >> (j0 - 31));
+
+	  result = (long long int) i0;
 	  if (j < i1)
-	    ++i0;
+	    ++result;
 
-	  if (j0 == 31)
-	    result = (long long int) i0;
-	  else
-	    result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+	  if (j0 > 31)
+	    result = (result << (j0 - 31)) | (j >> (63 - j0));
 	}
     }
   else