diff options
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_exp2.c | 6 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_log2.c (renamed from sysdeps/ieee754/dbl-64/s_log2.c) | 12 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_ilogb.c | 14 |
3 files changed, 17 insertions, 15 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c index d02af15ecc..699f44ec4e 100644 --- a/sysdeps/ieee754/dbl-64/e_exp2.c +++ b/sysdeps/ieee754/dbl-64/e_exp2.c @@ -1,5 +1,5 @@ /* Double-precision floating point 2^x. - Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating <geoffk@ozemail.com.au> @@ -44,10 +44,10 @@ double __ieee754_exp2 (double x) { static const double himark = (double) DBL_MAX_EXP; - static const double lomark = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1) - 1.0; + static const double lomark = (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1); /* Check for usual case. */ - if (isless (x, himark) && isgreater (x, lomark)) + if (isless (x, himark) && isgreaterequal (x, lomark)) { static const double THREEp42 = 13194139533312.0; int tval, unsafe; diff --git a/sysdeps/ieee754/dbl-64/s_log2.c b/sysdeps/ieee754/dbl-64/e_log2.c index 7379ce85e7..f05d0ce966 100644 --- a/sysdeps/ieee754/dbl-64/s_log2.c +++ b/sysdeps/ieee754/dbl-64/e_log2.c @@ -10,7 +10,7 @@ * ==================================================== */ -/* __log2(x) +/* __ieee754_log2(x) * Return the logarithm to base 2 of x * * Method : @@ -79,9 +79,9 @@ static double zero = 0.0; #endif #ifdef __STDC__ - double __log2(double x) + double __ieee754_log2(double x) #else - double __log2(x) + double __ieee754_log2(x) double x; #endif { @@ -128,9 +128,3 @@ static double zero = 0.0; return dk-((s*(f-R))-f)/ln2; } } - -weak_alias (__log2, log2) -#ifdef NO_LONG_DOUBLE -strong_alias (__log2, __log2l) -weak_alias (__log2, log2l) -#endif diff --git a/sysdeps/ieee754/dbl-64/s_ilogb.c b/sysdeps/ieee754/dbl-64/s_ilogb.c index 820f01c9b2..89a833781d 100644 --- a/sysdeps/ieee754/dbl-64/s_ilogb.c +++ b/sysdeps/ieee754/dbl-64/s_ilogb.c @@ -16,10 +16,12 @@ static char rcsid[] = "$NetBSD: s_ilogb.c,v 1.9 1995/05/10 20:47:28 jtc Exp $"; /* ilogb(double x) * return the binary exponent of non-zero x - * ilogb(0) = 0x80000001 - * ilogb(inf/NaN) = 0x7fffffff (no signal is raised) + * ilogb(0) = FP_ILOGB0 + * ilogb(NaN) = FP_ILOGBNAN (no signal is raised) + * ilogb(+-Inf) = INT_MAX (no signal is raised) */ +#include <limits.h> #include "math.h" #include "math_private.h" @@ -47,7 +49,13 @@ static char rcsid[] = "$NetBSD: s_ilogb.c,v 1.9 1995/05/10 20:47:28 jtc Exp $"; return ix; } else if (hx<0x7ff00000) return (hx>>20)-1023; - else return FP_ILOGBNAN; + else if (FP_ILOGBNAN != INT_MAX) { + /* ISO C99 requires ilogb(+-Inf) == INT_MAX. */ + GET_LOW_WORD(lx,x); + if(((hx^0x7ff00000)|lx) == 0) + return INT_MAX; + } + return FP_ILOGBNAN; } weak_alias (__ilogb, ilogb) #ifdef NO_LONG_DOUBLE |