summaryrefslogtreecommitdiffstats
path: root/newlib/libm/common/sf_ilogb.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libm/common/sf_ilogb.c')
-rw-r--r--newlib/libm/common/sf_ilogb.c13
1 files changed, 6 insertions, 7 deletions
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