Skip to content

Commit a1f9eeb

Browse files
futogkeith-packard
authored andcommitted
libm/math: Update atanh FE_INEXACT code
Replace the code that is there to generate FE_INEXACT with __math_inexact.
1 parent 3443db3 commit a1f9eeb

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

newlib/libm/math/s_atanh.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434

3535
#ifdef _NEED_FLOAT64
3636

37-
static const __float64 one = _F_64(1.0), huge = _F_64(1e300);
38-
39-
static const __float64 zero = _F_64(0.0);
37+
static const __float64 one = _F_64(1.0);
4038

4139
__float64
4240
atanh64(__float64 x)
@@ -50,8 +48,8 @@ atanh64(__float64 x)
5048
return __math_invalid(x);
5149
if (ix == 0x3ff00000)
5250
return __math_divzero(x < 0);
53-
if (ix < 0x3e300000 && (huge + x) > zero)
54-
return x; /* x<2**-28 */
51+
if (ix < 0x3e300000) /* x<2**-28 */
52+
return __math_inexact64(x);
5553
SET_HIGH_WORD(x, ix);
5654
if (ix < 0x3fe00000) { /* x < 0.5 */
5755
t = x + x;

newlib/libm/math/sf_atanh.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
#include "fdlibm.h"
1818

19-
static const float one = 1.0, huge = 1e30;
20-
21-
static const float zero = 0.0;
19+
static const float one = 1.0;
2220

2321
float
2422
atanhf(float x)
@@ -31,8 +29,8 @@ atanhf(float x)
3129
return __math_invalidf(x);
3230
if (ix == 0x3f800000)
3331
return __math_divzerof(x < 0);
34-
if (ix < 0x31800000 && (huge + x) > zero)
35-
return x; /* x<2**-28 */
32+
if (ix < 0x31800000) /* x<2**-28 */
33+
return __math_inexactf(x);
3634
SET_FLOAT_WORD(x, ix);
3735
if (ix < 0x3f000000) { /* x < 0.5 */
3836
t = x + x;

0 commit comments

Comments
 (0)