Skip to content

Commit bc276b6

Browse files
futogkeith-packard
authored andcommitted
libm/math: Update expm1 FE_INEXACT code
Replace the code that is there to generate FE_INEXACT with __math_inexact.
1 parent e767fad commit bc276b6

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

newlib/libm/common/s_expm1.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,8 @@ _NAME_64(expm1)(__float64 x)
185185
}
186186
if(x > o_threshold) return __math_oflow (0); /* overflow */
187187
}
188-
if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */
189-
if(x+tiny<_F_64(0.0)) /* raise inexact */
190-
return tiny-one; /* return -1 */
191-
}
188+
if(xsb!=0) /* x < -56*ln2, return -1.0 with inexact */
189+
return __math_inexact64(tiny-one); /* return -1 */
192190
}
193191

194192
/* argument reduction */

newlib/libm/common/sf_expm1.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ float expm1f(float x)
5353
return (xsb==0)? x:-1.0f;/* exp(+-inf)={inf,-1} */
5454
if(xsb == 0 && hx > FLT_UWORD_LOG_MAX) /* if x>=o_threshold */
5555
return __math_oflowf (0); /* overflow */
56-
if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */
57-
if(x+tiny<0.0f) /* raise inexact */
58-
return tiny-one; /* return -1 */
59-
}
56+
if(xsb!=0) /* x < -27*ln2, return -1.0 with inexact */
57+
return __math_inexactf(tiny-one); /* return -1 */
6058
}
6159

6260
/* argument reduction */

0 commit comments

Comments
 (0)