summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c')
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c
index b7ed14bfa2..f7e0a77ec3 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c
@@ -1,5 +1,5 @@
/* Round double to integer away from zero.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
+ Copyright (C) 2011-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2011.
@@ -33,18 +33,15 @@
#include <math.h>
#include <math_private.h>
#include <stdint.h>
+#include <libm-alias-double.h>
/*
* floor(x)
* Return x rounded toward -inf to integral value
* Method:
* Bit twiddling.
- * Exception:
- * Inexact flag raised if x not equal to floor(x).
*/
-static const double huge = 1.0e300;
-
double
__floor (double x)
@@ -53,15 +50,14 @@ __floor (double x)
EXTRACT_WORDS64(i0,x);
int32_t j0 = ((i0>>52)&0x7ff)-0x3ff;
if(__builtin_expect(j0<52, 1)) {
- if(j0<0) { /* raise inexact if x != 0 */
- math_force_eval(huge+x);/* return 0*sign(x) if |x|<1 */
+ if(j0<0) {
+ /* return 0*sign(x) if |x|<1 */
if(i0>=0) {i0=0;}
else if((i0&0x7fffffffffffffffl)!=0)
{ i0=0xbff0000000000000l;}
} else {
uint64_t i = (0x000fffffffffffffl)>>j0;
if((i0&i)==0) return x; /* x is integral */
- math_force_eval(huge+x); /* raise inexact flag */
if(i0<0) i0 += (0x0010000000000000l)>>j0;
i0 &= (~i);
}
@@ -71,9 +67,5 @@ __floor (double x)
return x;
}
#ifndef __floor
-weak_alias (__floor, floor)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__floor, __floorl)
-weak_alias (__floor, floorl)
-# endif
+libm_alias_double (__floor, floor)
#endif