Skip to content

Commit cd97828

Browse files
ZERICO2005mateoconlechuga
authored andcommitted
Cleaned up expm1f code.
1 parent 05a9781 commit cd97828

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/libc/expm1.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
#include <math.h>
22

3-
float expm1f(const float x)
3+
float expm1f(float x)
44
{
5-
#if 1
6-
/**
7-
* 0x1.0p-12f: At least 12.0bits of precision
8-
*/
9-
if (fabsf(x) < 2.44140625e-4f /* 0x1.0p-12f */) {
10-
return x;
11-
}
12-
#else
13-
/**
14-
* 0x1.0p-8f: At least 16.0bits of precision
15-
*/
16-
if (fabsf(x) < 3.90625e-3f /* 0x1.0p-8f */) {
17-
return x + 0.5f * (x * x);
18-
}
19-
#endif
5+
/**
6+
* 0x1.0p-8f: At least 16.0bits of precision
7+
*/
8+
if (fabsf(x) < 3.90625e-3f /* 0x1.0p-8f */) {
9+
return x + 0.5f * (x * x);
10+
}
2011
return expf(x) - 1.0f;
2112
}
2213

23-
2414
double expm1(double) __attribute__((alias("expm1f")));

0 commit comments

Comments
 (0)