summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/dbl-64/wordsize-64
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64/wordsize-64')
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c4
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c16
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c3
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c18
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c12
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c32
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c3
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c3
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c7
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c15
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c9
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c9
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c7
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c16
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c9
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c7
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_round.c15
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c71
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c54
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c49
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c46
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c9
24 files changed, 314 insertions, 104 deletions
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
index ccccdaf106..0af05a0222 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c
@@ -51,13 +51,13 @@ __ieee754_acosh (double x)
/* 2**28 > x > 2 */
double t = x * x;
- return __ieee754_log (2.0 * x - one / (x + __ieee754_sqrt (t - one)));
+ return __ieee754_log (2.0 * x - one / (x + sqrt (t - one)));
}
else if (__glibc_likely (hx > INT64_C (0x3ff0000000000000)))
{
/* 1<x<2 */
double t = x - one;
- return __log1p (t + __ieee754_sqrt (2.0 * t + t * t));
+ return __log1p (t + sqrt (2.0 * t + t * t));
}
else if (__glibc_likely (hx == INT64_C (0x3ff0000000000000)))
return 0.0; /* acosh(1) = 0 */
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c
index 4f5a81669e..cd5567182f 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_log10.c
@@ -65,7 +65,7 @@ __ieee754_log10 (double x)
if (hx < INT64_C(0x0010000000000000))
{ /* x < 2**-1022 */
if (__glibc_unlikely ((hx & UINT64_C(0x7fffffffffffffff)) == 0))
- return -two54 / (x - x); /* log(+-0)=-inf */
+ return -two54 / fabs (x); /* log(+-0)=-inf */
if (__glibc_unlikely (hx < 0))
return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c
index 5ccb78cf03..f08d5b337d 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_log2.c
@@ -81,7 +81,7 @@ __ieee754_log2 (double x)
if (hx < INT64_C(0x0010000000000000))
{ /* x < 2**-1022 */
if (__glibc_unlikely ((hx & UINT64_C(0x7fffffffffffffff)) == 0))
- return -two54 / (x - x); /* log(+-0)=-inf */
+ return -two54 / fabs (x); /* log(+-0)=-inf */
if (__glibc_unlikely (hx < 0))
return (x - x) / (x - x); /* log(-#) = NaN */
k -= 54;
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
index c687525d4b..b99829d2b0 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c
@@ -15,14 +15,11 @@
* Return x rounded toward -inf to integral value
* Method:
* Bit twiddling.
- * Exception:
- * Inexact flag raised if x not equal to ceil(x).
*/
#include <math.h>
#include <math_private.h>
-
-static const double huge = 1.0e300;
+#include <libm-alias-double.h>
double
__ceil(double x)
@@ -32,14 +29,13 @@ __ceil(double x)
EXTRACT_WORDS64(i0,x);
j0 = ((i0>>52)&0x7ff)-0x3ff;
if(j0<=51) {
- 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=INT64_C(0x8000000000000000);}
else if(i0!=0) { i0=INT64_C(0x3ff0000000000000);}
} else {
i = INT64_C(0x000fffffffffffff)>>j0;
if((i0&i)==0) return x; /* x is integral */
- math_force_eval(huge+x); /* raise inexact flag */
if(i0>0) i0 += UINT64_C(0x0010000000000000)>>j0;
i0 &= (~i);
}
@@ -51,9 +47,5 @@ __ceil(double x)
return x;
}
#ifndef __ceil
-weak_alias (__ceil, ceil)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__ceil, __ceill)
-weak_alias (__ceil, ceill)
-# endif
+libm_alias_double (__ceil, ceil)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
index ef51608f6e..40676924fe 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
@@ -16,6 +16,7 @@
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
#include <stdint.h>
@@ -30,7 +31,7 @@ __finite(double x)
hidden_def (__finite)
weak_alias (__finite, finite)
#ifdef NO_LONG_DOUBLE
-# ifdef LDBL_CLASSIFY_COMPAT
+# if LDBL_CLASSIFY_COMPAT
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
# endif
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
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
index 42068f8187..c73434f5f3 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
@@ -1,4 +1,4 @@
-/* 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@gmail.com>, 2011.
@@ -19,6 +19,7 @@
#include <inttypes.h>
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
/*
* for non-zero, finite x
@@ -55,12 +56,11 @@ __frexp (double x, int *eptr)
ix = (ix & INT64_C (0x800fffffffffffff)) | INT64_C (0x3fe0000000000000);
INSERT_WORDS64 (x, ix);
}
+ else
+ /* Quiet signaling NaNs. */
+ x += x;
*eptr = e;
return x;
}
-weak_alias (__frexp, frexp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__frexp, __frexpl)
-weak_alias (__frexp, frexpl)
-#endif
+libm_alias_double (__frexp, frexp)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c
new file mode 100644
index 0000000000..1103ef2ed9
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c
@@ -0,0 +1,32 @@
+/* Get NaN payload. dbl-64/wordsize-64 version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+double
+__getpayload (const double *x)
+{
+ uint64_t ix;
+ EXTRACT_WORDS64 (ix, *x);
+ ix &= 0x7ffffffffffffULL;
+ return (double) ix;
+}
+libm_alias_double (__getpayload, getpayload)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
index 951fb73239..2b427a8b4c 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
@@ -11,6 +11,7 @@
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
int
@@ -26,7 +27,7 @@ __isinf (double x)
hidden_def (__isinf)
weak_alias (__isinf, isinf)
#ifdef NO_LONG_DOUBLE
-# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
# endif
weak_alias (__isinf, isinfl)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
index bcff9e3b67..cd805d157b 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
@@ -17,6 +17,7 @@
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
#include <stdint.h>
@@ -32,7 +33,7 @@ int __isnan(double x)
hidden_def (__isnan)
weak_alias (__isnan, isnan)
#ifdef NO_LONG_DOUBLE
-# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
# endif
weak_alias (__isnan, isnanl)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c
index c22e608c6e..63ef5ca7d8 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c
@@ -1,5 +1,5 @@
/* Test for signaling NaN.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,13 +18,14 @@
#include <math.h>
#include <math_private.h>
+#include <nan-high-order-bit.h>
int
__issignaling (double x)
{
- u_int64_t xi;
+ uint64_t xi;
EXTRACT_WORDS64 (xi, x);
-#ifdef HIGH_ORDER_BIT_IS_SET_FOR_SNAN
+#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN
/* We only have to care about the high-order bit of x's significand, because
having it set (sNaN) already makes the significand different from that
used to designate infinity. */
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
index 73ddd8dd9f..e3b18eb893 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
@@ -1,5 +1,5 @@
/* Round double value to long long int.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -24,6 +24,7 @@
#include <sysdep.h>
#include <math_private.h>
+#include <libm-alias-double.h>
long long int
@@ -63,20 +64,12 @@ __llround (double x)
return sign * result;
}
-weak_alias (__llround, llround)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__llround, __llroundl)
-weak_alias (__llround, llroundl)
-#endif
+libm_alias_double (__llround, llround)
/* long has the same width as long long on LP64 machines, so use an alias. */
#undef lround
#undef __lround
#ifdef _LP64
strong_alias (__llround, __lround)
-weak_alias (__llround, lround)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__llround, __lroundl)
-weak_alias (__llround, lroundl)
-# endif
+libm_alias_double (__lround, lround)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
index c7846054a6..c7fa8169c5 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
@@ -1,5 +1,5 @@
/* Compute radix independent exponent.
- 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@gmail.com>, 2011.
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
double
@@ -41,8 +42,6 @@ __logb (double x)
}
return (double) (ex - 1023);
}
-weak_alias (__logb, logb)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__logb, __logbl)
-weak_alias (__logb, logbl)
+#ifndef __logb
+libm_alias_double (__logb, logb)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
index 9e665b01ec..a88c6c8788 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
@@ -1,5 +1,5 @@
/* Round double value to long int.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
/* For LP64, lround is an alias for llround. */
#ifndef _LP64
@@ -80,10 +81,6 @@ __lround (double x)
return sign * result;
}
-weak_alias (__lround, lround)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__lround, __lroundl)
-weak_alias (__lround, lroundl)
-# endif
+libm_alias_double (__lround, lround)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c
index c309e56272..8d14e78ef0 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_modf.c
@@ -22,6 +22,7 @@
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
#include <stdint.h>
static const double one = 1.0;
@@ -59,8 +60,6 @@ __modf(double x, double *iptr)
return x;
}
}
-weak_alias (__modf, modf)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__modf, __modfl)
-weak_alias (__modf, modfl)
+#ifndef __modf
+libm_alias_double (__modf, modf)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
index 8293819981..a4a081724e 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c
@@ -22,7 +22,9 @@
#include <fenv.h>
#include <math.h>
+#include <math-barriers.h>
#include <math_private.h>
+#include <libm-alias-double.h>
static const double
TWO52[2]={
@@ -42,9 +44,9 @@ __nearbyint(double x)
if(__builtin_expect(j0<52, 1)) {
if(j0<0) {
libc_feholdexcept (&env);
- double w = TWO52[sx]+x;
+ double w = TWO52[sx] + math_opt_barrier (x);
double t = w-TWO52[sx];
- math_opt_barrier(t);
+ math_force_eval (t);
libc_fesetenv (&env);
return __copysign (t, x);
}
@@ -53,14 +55,10 @@ __nearbyint(double x)
else return x; /* x is integral */
}
libc_feholdexcept (&env);
- double w = TWO52[sx]+x;
+ double w = TWO52[sx] + math_opt_barrier (x);
double t = w-TWO52[sx];
- math_opt_barrier (t);
+ math_force_eval (t);
libc_fesetenv (&env);
return t;
}
-weak_alias (__nearbyint, nearbyint)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__nearbyint, __nearbyintl)
-weak_alias (__nearbyint, nearbyintl)
-#endif
+libm_alias_double (__nearbyint, nearbyint)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
index 716e07e54d..bbfb1195ac 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
@@ -1,5 +1,5 @@
/* Compute remainder and a congruent to the quotient.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
#include <stdint.h>
static const double zero = 0.0;
@@ -107,8 +108,4 @@ __remquo (double x, double y, int *quo)
x = -x;
return x;
}
-weak_alias (__remquo, remquo)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__remquo, __remquol)
-weak_alias (__remquo, remquol)
-#endif
+libm_alias_double (__remquo, remquo)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c
index 87b2339d43..622e479c5f 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c
@@ -21,6 +21,7 @@
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
static const double
TWO52[2]={
@@ -52,9 +53,5 @@ __rint(double x)
return w-TWO52[sx];
}
#ifndef __rint
-weak_alias (__rint, rint)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__rint, __rintl)
-weak_alias (__rint, rintl)
-# endif
+libm_alias_double (__rint, rint)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
index f1d75bbe68..3323621ce3 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
@@ -1,5 +1,5 @@
/* Round double to integer away from zero.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -20,10 +20,9 @@
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
#include <stdint.h>
-static const double huge = 1.0e300;
-
double
__round (double x)
@@ -36,8 +35,6 @@ __round (double x)
{
if (j0 < 0)
{
- math_force_eval (huge + x);
-
i0 &= UINT64_C(0x8000000000000000);
if (j0 == -1)
i0 |= UINT64_C(0x3ff0000000000000);
@@ -48,9 +45,7 @@ __round (double x)
if ((i0 & i) == 0)
/* X is integral. */
return x;
- math_force_eval (huge + x);
- /* Raise inexact if x != 0. */
i0 += UINT64_C(0x0008000000000000) >> j0;
i0 &= ~i;
}
@@ -67,8 +62,4 @@ __round (double x)
INSERT_WORDS64 (x, i0);
return x;
}
-weak_alias (__round, round)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__round, __roundl)
-weak_alias (__round, roundl)
-#endif
+libm_alias_double (__round, round)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c
new file mode 100644
index 0000000000..7bbbb2dc20
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c
@@ -0,0 +1,71 @@
+/* Round to nearest integer value, rounding halfway cases to even.
+ dbl-64/wordsize-64 version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+#define BIAS 0x3ff
+#define MANT_DIG 53
+#define MAX_EXP (2 * BIAS + 1)
+
+double
+__roundeven (double x)
+{
+ uint64_t ix, ux;
+ EXTRACT_WORDS64 (ix, x);
+ ux = ix & 0x7fffffffffffffffULL;
+ int exponent = ux >> (MANT_DIG - 1);
+ if (exponent >= BIAS + MANT_DIG - 1)
+ {
+ /* Integer, infinity or NaN. */
+ if (exponent == MAX_EXP)
+ /* Infinity or NaN; quiet signaling NaNs. */
+ return x + x;
+ else
+ return x;
+ }
+ else if (exponent >= BIAS)
+ {
+ /* At least 1; not necessarily an integer. Locate the bits with
+ exponents 0 and -1 (when the unbiased exponent is 0, the bit
+ with exponent 0 is implicit, but as the bias is odd it is OK
+ to take it from the low bit of the exponent). */
+ int int_pos = (BIAS + MANT_DIG - 1) - exponent;
+ int half_pos = int_pos - 1;
+ uint64_t half_bit = 1ULL << half_pos;
+ uint64_t int_bit = 1ULL << int_pos;
+ if ((ix & (int_bit | (half_bit - 1))) != 0)
+ /* Carry into the exponent works correctly. No need to test
+ whether HALF_BIT is set. */
+ ix += half_bit;
+ ix &= ~(int_bit - 1);
+ }
+ else if (exponent == BIAS - 1 && ux > 0x3fe0000000000000ULL)
+ /* Interval (0.5, 1). */
+ ix = (ix & 0x8000000000000000ULL) | 0x3ff0000000000000ULL;
+ else
+ /* Rounds to 0. */
+ ix &= 0x8000000000000000ULL;
+ INSERT_WORDS64 (x, ix);
+ return x;
+}
+hidden_def (__roundeven)
+libm_alias_double (__roundeven, roundeven)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c
new file mode 100644
index 0000000000..6af92d7fe2
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c
@@ -0,0 +1,54 @@
+/* Set NaN payload. dbl-64/wordsize-64 version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <math_private.h>
+#include <libm-alias-double.h>
+#include <nan-high-order-bit.h>
+#include <stdint.h>
+
+#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG)
+#define BIAS 0x3ff
+#define PAYLOAD_DIG 51
+#define EXPLICIT_MANT_DIG 52
+
+int
+FUNC (double *x, double payload)
+{
+ uint64_t ix;
+ EXTRACT_WORDS64 (ix, payload);
+ int exponent = ix >> EXPLICIT_MANT_DIG;
+ /* Test if argument is (a) negative or too large; (b) too small,
+ except for 0 when allowed; (c) not an integer. */
+ if (exponent >= BIAS + PAYLOAD_DIG
+ || (exponent < BIAS && !(SET_HIGH_BIT && ix == 0))
+ || (ix & ((1ULL << (BIAS + EXPLICIT_MANT_DIG - exponent)) - 1)) != 0)
+ {
+ INSERT_WORDS64 (*x, 0);
+ return 1;
+ }
+ if (ix != 0)
+ {
+ ix &= (1ULL << EXPLICIT_MANT_DIG) - 1;
+ ix |= 1ULL << EXPLICIT_MANT_DIG;
+ ix >>= BIAS + EXPLICIT_MANT_DIG - exponent;
+ }
+ ix |= 0x7ff0000000000000ULL | (SET_HIGH_BIT ? 0x8000000000000ULL : 0);
+ INSERT_WORDS64 (*x, ix);
+ return 0;
+}
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c
new file mode 100644
index 0000000000..c235e55c20
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c
@@ -0,0 +1,49 @@
+/* Total order operation. dbl-64/wordsize-64 version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <math_private.h>
+#include <nan-high-order-bit.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+int
+__totalorder (double x, double y)
+{
+ int64_t ix, iy;
+ EXTRACT_WORDS64 (ix, x);
+ EXTRACT_WORDS64 (iy, y);
+#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN
+ /* For the preferred quiet NaN convention, this operation is a
+ comparison of the representations of the arguments interpreted as
+ sign-magnitude integers. If both arguments are NaNs, invert the
+ quiet/signaling bit so comparing that way works. */
+ if ((ix & 0x7fffffffffffffffULL) > 0x7ff0000000000000ULL
+ && (iy & 0x7fffffffffffffffULL) > 0x7ff0000000000000ULL)
+ {
+ ix ^= 0x0008000000000000ULL;
+ iy ^= 0x0008000000000000ULL;
+ }
+#endif
+ uint64_t ix_sign = ix >> 63;
+ uint64_t iy_sign = iy >> 63;
+ ix ^= ix_sign >> 1;
+ iy ^= iy_sign >> 1;
+ return ix <= iy;
+}
+libm_alias_double (__totalorder, totalorder)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
new file mode 100644
index 0000000000..6da4f118a3
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
@@ -0,0 +1,46 @@
+/* Total order operation on absolute values. dbl-64/wordsize-64 version.
+ Copyright (C) 2016-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <math_private.h>
+#include <nan-high-order-bit.h>
+#include <libm-alias-double.h>
+#include <stdint.h>
+
+int
+__totalordermag (double x, double y)
+{
+ uint64_t ix, iy;
+ EXTRACT_WORDS64 (ix, x);
+ EXTRACT_WORDS64 (iy, y);
+ ix &= 0x7fffffffffffffffULL;
+ iy &= 0x7fffffffffffffffULL;
+#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN
+ /* For the preferred quiet NaN convention, this operation is a
+ comparison of the representations of the absolute values of the
+ arguments. If both arguments are NaNs, invert the
+ quiet/signaling bit so comparing that way works. */
+ if (ix > 0x7ff0000000000000ULL && iy > 0x7ff0000000000000ULL)
+ {
+ ix ^= 0x0008000000000000ULL;
+ iy ^= 0x0008000000000000ULL;
+ }
+#endif
+ return ix <= iy;
+}
+libm_alias_double (__totalordermag, totalordermag)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c
index 81ac55e2f6..19a09b894e 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c
@@ -1,5 +1,5 @@
/* Truncate argument to nearest integral value not larger than the argument.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#include <libm-alias-double.h>
double
@@ -48,8 +49,6 @@ __trunc (double x)
return x;
}
-weak_alias (__trunc, trunc)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__trunc, __truncl)
-weak_alias (__trunc, truncl)
+#ifndef __trunc
+libm_alias_double (__trunc, trunc)
#endif