aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/flt-32/s_nearbyintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/flt-32/s_nearbyintf.c')
-rw-r--r--sysdeps/ieee754/flt-32/s_nearbyintf.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c
index acedf34c90..b37e003e12 100644
--- a/sysdeps/ieee754/flt-32/s_nearbyintf.c
+++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c
@@ -21,16 +21,20 @@
#include <math_private.h>
#include <fenv_private.h>
#include <libm-alias-float.h>
-
-static const float
-TWO23[2]={
- 8.3886080000e+06, /* 0x4b000000 */
- -8.3886080000e+06, /* 0xcb000000 */
-};
+#include <math-use-builtins.h>
float
__nearbyintf(float x)
{
+#if USE_NEARBYINTF_BUILTIN
+ return __builtin_nearbyintf (x);
+#else
+ /* Use generic implementation. */
+ static const float
+ TWO23[2] = {
+ 8.3886080000e+06, /* 0x4b000000 */
+ -8.3886080000e+06, /* 0xcb000000 */
+ };
fenv_t env;
int32_t i0,j0,sx;
float w,t;
@@ -58,5 +62,6 @@ __nearbyintf(float x)
math_force_eval (t);
libc_fesetenvf (&env);
return t;
+#endif /* ! USE_NEARBYINT_BUILTIN */
}
libm_alias_float (__nearbyint, nearbyint)