diff options
Diffstat (limited to 'newlib/libm/math/ef_cosh.c')
-rw-r--r-- | newlib/libm/math/ef_cosh.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/newlib/libm/math/ef_cosh.c b/newlib/libm/math/ef_cosh.c index 68e59f886..bdce61a00 100644 --- a/newlib/libm/math/ef_cosh.c +++ b/newlib/libm/math/ef_cosh.c @@ -39,7 +39,7 @@ static float one = 1.0, half=0.5, huge = 1.0e30; ix &= 0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) return x*x; + if(!FLT_UWORD_IS_FINITE(ix)) return x*x; /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ if(ix<0x3eb17218) { @@ -56,10 +56,11 @@ static float one = 1.0, half=0.5, huge = 1.0e30; } /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x42b17180) return half*__ieee754_expf(fabsf(x)); + if (ix <= FLT_UWORD_LOG_MAX) + return half*__ieee754_expf(fabsf(x)); /* |x| in [log(maxdouble), overflowthresold] */ - if (ix<=0x42b2d4fc) { + if (ix <= FLT_UWORD_LOG_2MAX) { w = __ieee754_expf(half*fabsf(x)); t = half*w; return t*w; |