summaryrefslogtreecommitdiffstats
path: root/newlib/libm/common/sf_expm1.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2001-04-04 13:33:01 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2001-04-04 13:33:01 +0000
commit16740220a22d09a1c63714d93f1efc5fbe3927f3 (patch)
tree7b24242b9b20a0ee328c94acd2c95e1a8778c944 /newlib/libm/common/sf_expm1.c
parent51fc3813e9a9ef8079b2fbde1b12647dd3f4ac93 (diff)
downloadcygnal-16740220a22d09a1c63714d93f1efc5fbe3927f3.tar.gz
cygnal-16740220a22d09a1c63714d93f1efc5fbe3927f3.tar.bz2
cygnal-16740220a22d09a1c63714d93f1efc5fbe3927f3.zip
* 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.
Diffstat (limited to 'newlib/libm/common/sf_expm1.c')
-rw-r--r--newlib/libm/common/sf_expm1.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/newlib/libm/common/sf_expm1.c b/newlib/libm/common/sf_expm1.c
index e9108b7b8..4ba3b815a 100644
--- a/newlib/libm/common/sf_expm1.c
+++ b/newlib/libm/common/sf_expm1.c
@@ -27,7 +27,6 @@ static float
one = 1.0,
huge = 1.0e+30,
tiny = 1.0e-30,
-o_threshold = 8.8721679688e+01,/* 0x42b17180 */
ln2_hi = 6.9313812256e-01,/* 0x3f317180 */
ln2_lo = 9.0580006145e-06,/* 0x3717f7d1 */
invln2 = 1.4426950216e+00,/* 0x3fb8aa3b */
@@ -56,13 +55,12 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */
/* filter out huge and non-finite argument */
if(hx >= 0x4195b844) { /* if |x|>=27*ln2 */
- if(hx >= 0x42b17218) { /* if |x|>=88.721... */
- if(hx>0x7f800000)
- return x+x; /* NaN */
- if(hx==0x7f800000)
- return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
- if(x > o_threshold) return huge*huge; /* overflow */
- }
+ if(FLT_UWORD_IS_NAN(hx))
+ return x+x;
+ if(FLT_UWORD_IS_INFINITE(hx))
+ return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
+ if(xsb == 0 && hx > FLT_UWORD_LOG_MAX) /* if x>=o_threshold */
+ return huge*huge; /* overflow */
if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */
if(x+tiny<(float)0.0) /* raise inexact */
return tiny-one; /* return -1 */