diff options
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/s_ilogbl.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_ilogbl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/ieee754/ldbl-128/s_ilogbl.c b/sysdeps/ieee754/ldbl-128/s_ilogbl.c index d2acfd3105..c042aa43d8 100644 --- a/sysdeps/ieee754/ldbl-128/s_ilogbl.c +++ b/sysdeps/ieee754/ldbl-128/s_ilogbl.c @@ -19,8 +19,9 @@ 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 "math.h" @@ -50,6 +51,11 @@ static char rcsid[] = "$NetBSD: $"; return ix; } else if (hx<0x7fff000000000000LL) return (hx>>48)-0x3fff; - else return FP_ILOGBNAN; + else if (FP_ILOGBNAN != INT_MAX) { + /* ISO C99 requires ilogbl(+-Inf) == INT_MAX. */ + if (((hx^0x7fff000000000000LL)|lx) == 0) + return INT_MAX; + } + return FP_ILOGBNAN; } weak_alias (__ilogbl, ilogbl) |