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/math_private.h36
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c12
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c5
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c20
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c5
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c3
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c19
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c90
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_round.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c2
15 files changed, 117 insertions, 87 deletions
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/math_private.h b/sysdeps/ieee754/dbl-64/wordsize-64/math_private.h
deleted file mode 100644
index 4f9219934a..0000000000
--- a/sysdeps/ieee754/dbl-64/wordsize-64/math_private.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _MATH_PRIVATE_H_
-
-#include_next <math_private.h>
-#include <stdint.h>
-
-#ifndef __isnan
-extern __always_inline int
-__isnan (double d)
-{
- uint64_t di;
- EXTRACT_WORDS64 (di, d);
- return (di & 0x7fffffffffffffffull) > 0x7ff0000000000000ull;
-}
-#endif
-
-#ifndef __isinf_ns
-extern __always_inline int
-__isinf_ns (double d)
-{
- uint64_t di;
- EXTRACT_WORDS64 (di, d);
- return (di & 0x7fffffffffffffffull) == 0x7ff0000000000000ull;
-}
-#endif
-
-#ifndef __finite
-extern __always_inline int
-__finite (double d)
-{
- uint64_t di;
- EXTRACT_WORDS64 (di, d);
- return (di & 0x7fffffffffffffffull) < 0x7ff0000000000000ull;
-}
-#endif
-
-#endif /* _MATH_PRIVATE_H_ */
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
index fcf2e6d5b6..ef51608f6e 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 <shlib-compat.h>
#include <stdint.h>
#undef __finite
@@ -24,11 +25,18 @@ __finite(double x)
{
int64_t lx;
EXTRACT_WORDS64(lx,x);
- return (int)((uint64_t)((lx&INT64_C(0x7fffffffffffffff))-INT64_C(0x7ff0000000000000))>>63);
+ return (int)((uint64_t)((lx&INT64_C(0x7ff0000000000000))-INT64_C(0x7ff0000000000000))>>63);
}
hidden_def (__finite)
weak_alias (__finite, finite)
#ifdef NO_LONG_DOUBLE
-strong_alias (__finite, __finitel)
+# ifdef LDBL_CLASSIFY_COMPAT
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
+# endif
+# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_23)
+compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
+# endif
+# endif
weak_alias (__finite, finitel)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c
index 0dbadb15eb..b7ed14bfa2 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-2015 Free Software Foundation, Inc.
+ Copyright (C) 2011-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2011.
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_frexp.c
index f1fa3154ee..42068f8187 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-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
index 163fc31efc..951fb73239 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 <shlib-compat.h>
int
__isinf (double x)
@@ -25,6 +26,8 @@ __isinf (double x)
hidden_def (__isinf)
weak_alias (__isinf, isinf)
#ifdef NO_LONG_DOUBLE
-strong_alias (__isinf, __isinfl)
+# if defined 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)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c
deleted file mode 100644
index 9d78ed13ae..0000000000
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf_ns.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Written by Ulrich Drepper <drepper@gmail.com>.
- */
-
-/*
- * __isinf_ns(x) returns != 0 if x is ±inf, else 0;
- * no branching!
- */
-
-#include <math.h>
-#include <math_private.h>
-
-#undef __isinf_ns
-int
-__isinf_ns (double x)
-{
- int64_t ix;
- EXTRACT_WORDS64(ix,x);
- return (ix & UINT64_C(0x7fffffffffffffff)) == UINT64_C(0x7ff0000000000000);
-}
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
index e80b84ca02..bcff9e3b67 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 <shlib-compat.h>
#include <stdint.h>
#undef __isnan
@@ -31,6 +32,8 @@ int __isnan(double x)
hidden_def (__isnan)
weak_alias (__isnan, isnan)
#ifdef NO_LONG_DOUBLE
-strong_alias (__isnan, __isnanl)
+# if defined 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)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c
index 67d77d5732..c22e608c6e 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-2015 Free Software Foundation, Inc.
+ Copyright (C) 2013-2016 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
@@ -25,7 +25,6 @@ __issignaling (double x)
u_int64_t xi;
EXTRACT_WORDS64 (xi, x);
#ifdef HIGH_ORDER_BIT_IS_SET_FOR_SNAN
-# error untested
/* 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 8bb52524b7..73ddd8dd9f 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-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -69,23 +69,10 @@ strong_alias (__llround, __llroundl)
weak_alias (__llround, llroundl)
#endif
-/* long has the same width as long long on LP64 machines, so use an alias.
- If building for ILP32 on a machine with 64-bit registers, however,
- use a cast if necessary. */
+/* long has the same width as long long on LP64 machines, so use an alias. */
#undef lround
#undef __lround
-#if !defined (_LP64) && REGISTER_CAST_INT32_TO_INT64
-long int
-__lround (double x)
-{
- return __llround (x);
-}
-weak_alias (__lround, lround)
-# ifdef NO_LONG_DOUBLE
-strong_alias (__lround, __lroundl)
-weak_alias (__lround, lroundl)
-# endif
-#else
+#ifdef _LP64
strong_alias (__llround, __lround)
weak_alias (__llround, lround)
# ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
index 1d20e93e6d..c7846054a6 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-2015 Free Software Foundation, Inc.
+ Copyright (C) 2011-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
index 1e06fcb16e..9e665b01ec 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c
@@ -1 +1,89 @@
-/* The code is the same as llround. Use an alias, see s_llround.c. */
+/* Round double value to long int.
+ Copyright (C) 1997-2016 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 <fenv.h>
+#include <limits.h>
+#include <math.h>
+
+#include <math_private.h>
+
+/* For LP64, lround is an alias for llround. */
+#ifndef _LP64
+
+long int
+__lround (double x)
+{
+ int32_t j0;
+ int64_t i0;
+ long int result;
+ int sign;
+
+ EXTRACT_WORDS64 (i0, x);
+ j0 = ((i0 >> 52) & 0x7ff) - 0x3ff;
+ sign = i0 < 0 ? -1 : 1;
+ i0 &= UINT64_C(0xfffffffffffff);
+ i0 |= UINT64_C(0x10000000000000);
+
+ if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
+ {
+ if (j0 < 0)
+ return j0 < -1 ? 0 : sign;
+ else if (j0 >= 52)
+ result = i0 << (j0 - 52);
+ else
+ {
+ i0 += UINT64_C(0x8000000000000) >> j0;
+
+ result = i0 >> (52 - j0);
+#ifdef FE_INVALID
+ if (sizeof (long int) == 4
+ && sign == 1
+ && result == LONG_MIN)
+ /* Rounding brought the value out of range. */
+ feraiseexcept (FE_INVALID);
+#endif
+ }
+ }
+ else
+ {
+ /* The number is too large. Unless it rounds to LONG_MIN,
+ FE_INVALID must be raised and the return value is
+ unspecified. */
+#ifdef FE_INVALID
+ if (sizeof (long int) == 4
+ && x <= (double) LONG_MIN - 0.5)
+ {
+ /* If truncation produces LONG_MIN, the cast will not raise
+ the exception, but may raise "inexact". */
+ feraiseexcept (FE_INVALID);
+ return LONG_MIN;
+ }
+#endif
+ return (long int) x;
+ }
+
+ return sign * result;
+}
+
+weak_alias (__lround, lround)
+# ifdef NO_LONG_DOUBLE
+strong_alias (__lround, __lroundl)
+weak_alias (__lround, lroundl)
+# endif
+
+#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c
index 304e9d0fb4..716e07e54d 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-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_round.c
index 565a4622d4..f1d75bbe68 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-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c
index 3822e1737d..d517a919c8 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c
@@ -55,8 +55,6 @@ __scalbn (double x, int n)
INSERT_WORDS64(x,(ix&INT64_C(0x800fffffffffffff))|(k<<52));
return x*twom54;
}
-weak_alias (__scalbn, scalbn)
#ifdef NO_LONG_DOUBLE
strong_alias (__scalbn, __scalbnl)
-weak_alias (__scalbn, scalbnl)
#endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c
index 3810f8134d..81ac55e2f6 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-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.