summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/flt-32
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/flt-32')
-rw-r--r--sysdeps/ieee754/flt-32/e_exp2f.c10
-rw-r--r--sysdeps/ieee754/flt-32/e_expf.c14
-rw-r--r--sysdeps/ieee754/flt-32/s_nearbyintf.c28
3 files changed, 17 insertions, 35 deletions
diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c
index 0703cea403..f07500d20d 100644
--- a/sysdeps/ieee754/flt-32/e_exp2f.c
+++ b/sysdeps/ieee754/flt-32/e_exp2f.c
@@ -57,11 +57,7 @@ __ieee754_exp2f (float x)
union ieee754_float ex2_u, scale_u;
fenv_t oldenv;
- feholdexcept (&oldenv);
-#ifdef FE_TONEAREST
- /* If we don't have this, it's too bad. */
- fesetround (FE_TONEAREST);
-#endif
+ libc_feholdexcept_setroundf (&oldenv, FE_TONEAREST);
/* 1. Argument reduction.
Choose integers ex, -128 <= t < 128, and some real
@@ -104,7 +100,7 @@ __ieee754_exp2f (float x)
x22 = (.24022656679f * x + .69314736128f) * ex2_u.f;
/* 5. Return (2^x2-1) * 2^(t/512+e+ex) + 2^(t/512+e+ex). */
- fesetenv (&oldenv);
+ libc_fesetenv (&oldenv);
result = x22 * x + ex2_u.f;
@@ -116,7 +112,7 @@ __ieee754_exp2f (float x)
/* Exceptional cases: */
else if (isless (x, himark))
{
- if (__isinff (x))
+ if (__isinf_nsf (x))
/* e^-inf == 0, with no error. */
return 0;
else
diff --git a/sysdeps/ieee754/flt-32/e_expf.c b/sysdeps/ieee754/flt-32/e_expf.c
index 872d34bc5b..02105c4385 100644
--- a/sysdeps/ieee754/flt-32/e_expf.c
+++ b/sysdeps/ieee754/flt-32/e_expf.c
@@ -47,9 +47,6 @@
to perform an 'accurate table method' expf, because of the range reduction
overhead (compare exp2f).
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
#include <float.h>
#include <ieee754.h>
#include <math.h>
@@ -60,8 +57,8 @@
extern const float __exp_deltatable[178];
extern const double __exp_atable[355] /* __attribute__((mode(DF))) */;
-static const volatile float TWOM100 = 7.88860905e-31;
-static const volatile float TWO127 = 1.7014118346e+38;
+static const float TWOM100 = 7.88860905e-31;
+static const float TWO127 = 1.7014118346e+38;
float
__ieee754_expf (float x)
@@ -86,10 +83,7 @@ __ieee754_expf (float x)
union ieee754_double ex2_u;
fenv_t oldenv;
- feholdexcept (&oldenv);
-#ifdef FE_TONEAREST
- fesetround (FE_TONEAREST);
-#endif
+ libc_feholdexcept_setroundf (&oldenv, FE_TONEAREST);
/* Calculate n. */
n = x * M_1_LN2 + THREEp22;
@@ -119,7 +113,7 @@ __ieee754_expf (float x)
x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta;
/* Return result. */
- fesetenv (&oldenv);
+ libc_fesetenvf (&oldenv);
result = x22 * ex2_u.d + ex2_u.d;
return (float) result;
diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c
index 7d6f262f51..04ef9ab20c 100644
--- a/sysdeps/ieee754/flt-32/s_nearbyintf.c
+++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c
@@ -19,22 +19,14 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const float
-#else
-static float
-#endif
TWO23[2]={
8.3886080000e+06, /* 0x4b000000 */
-8.3886080000e+06, /* 0xcb000000 */
};
-#ifdef __STDC__
- float __nearbyintf(float x)
-#else
- float __nearbyintf(x)
- float x;
-#endif
+float
+__nearbyintf(float x)
{
fenv_t env;
int32_t i0,j0,sx;
@@ -50,13 +42,13 @@ TWO23[2]={
i0 &= 0xfff00000;
i0 |= ((i1|-i1)>>9)&0x400000;
SET_FLOAT_WORD(x,i0);
- feholdexcept (&env);
- w = TWO23[sx]+x;
- t = w-TWO23[sx];
- fesetenv (&env);
+ libc_feholdexceptf (&env);
+ w = TWO23[sx]+x;
+ t = w-TWO23[sx];
+ libc_fesetenvf (&env);
GET_FLOAT_WORD(i0,t);
SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31));
- return t;
+ return t;
} else {
i = (0x007fffff)>>j0;
if((i0&i)==0) return x; /* x is integral */
@@ -64,14 +56,14 @@ TWO23[2]={
if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0);
}
} else {
- if(j0==0x80) return x+x; /* inf or NaN */
+ if(__builtin_expect(j0==0x80, 0)) return x+x; /* inf or NaN */
else return x; /* x is integral */
}
SET_FLOAT_WORD(x,i0);
- feholdexcept (&env);
+ libc_feholdexceptf (&env);
w = TWO23[sx]+x;
t = w-TWO23[sx];
- fesetenv (&env);
+ libc_fesetenvf (&env);
return t;
}
weak_alias (__nearbyintf, nearbyintf)