From 16740220a22d09a1c63714d93f1efc5fbe3927f3 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 4 Apr 2001 13:33:01 +0000 Subject: * libc/include/machine/ieeefp.h: Comment about new configuration macros _FLT_LARGEST_EXPONENT_IS_NORMAL and _FLT_NO_DENORMALS. * libm/common/fdlib.h: Define new macros for testing floats. * libm/common/sf_*: Use them. * libm/math/ef_*: Likewise. * libm/math/sf_*: Likewise. --- newlib/libm/common/sf_ilogb.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'newlib/libm/common/sf_ilogb.c') diff --git a/newlib/libm/common/sf_ilogb.c b/newlib/libm/common/sf_ilogb.c index ee65594b1..ec59406e1 100644 --- a/newlib/libm/common/sf_ilogb.c +++ b/newlib/libm/common/sf_ilogb.c @@ -27,15 +27,14 @@ GET_FLOAT_WORD(hx,x); hx &= 0x7fffffff; - if(hx<0x00800000) { - if(hx==0) - return - INT_MAX; /* ilogb(0) = 0x80000001 */ - else /* subnormal x */ - for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; + if(FLT_UWORD_IS_ZERO(hx)) + return - INT_MAX; /* ilogb(0) = 0x80000001 */ + if(FLT_UWORD_IS_SUBNORMAL(hx)) { + for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; return ix; } - else if (hx<0x7f800000) return (hx>>23)-127; - else return INT_MAX; + else if (!FLT_UWORD_IS_FINITE(hx)) return INT_MAX; + else return (hx>>23)-127; } #ifdef _DOUBLE_IS_32BITS -- cgit v1.2.3