summaryrefslogtreecommitdiff
path: root/libc/sysdeps/ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/ieee754')
-rw-r--r--libc/sysdeps/ieee754/flt-32/e_jnf.c4
-rw-r--r--libc/sysdeps/ieee754/flt-32/e_lgammaf_r.c4
-rw-r--r--libc/sysdeps/ieee754/k_standard.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/e_expl.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/strtold_l.c12
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h19
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c9
-rw-r--r--libc/sysdeps/ieee754/ldbl-64-128/strtold_l.c12
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/strtold_l.c9
-rw-r--r--libc/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h2
12 files changed, 50 insertions, 31 deletions
diff --git a/libc/sysdeps/ieee754/flt-32/e_jnf.c b/libc/sysdeps/ieee754/flt-32/e_jnf.c
index ad26d7e8a..5984d94a3 100644
--- a/libc/sysdeps/ieee754/flt-32/e_jnf.c
+++ b/libc/sysdeps/ieee754/flt-32/e_jnf.c
@@ -54,7 +54,7 @@ __ieee754_jnf(int n, float x)
b = __ieee754_j1f(x);
for(i=1;i<n;i++){
temp = b;
- b = b*((float)(i+i)/x) - a; /* avoid underflow */
+ b = b*((double)(i+i)/x) - a; /* avoid underflow */
a = temp;
}
} else {
@@ -196,7 +196,7 @@ __ieee754_ynf(int n, float x)
GET_FLOAT_WORD(ib,b);
for(i=1;i<n&&ib!=0xff800000;i++){
temp = b;
- b = ((float)(i+i)/x)*b - a;
+ b = ((double)(i+i)/x)*b - a;
GET_FLOAT_WORD(ib,b);
a = temp;
}
diff --git a/libc/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/libc/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index 2e9226908..0dba9af8d 100644
--- a/libc/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/libc/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -150,8 +150,8 @@ __ieee754_lgammaf_r(float x, int *signgamp)
*signgamp = -1;
return one/fabsf(x);
}
- if(__builtin_expect(ix<0x1c800000, 0)) {
- /* |x|<2**-70, return -log(|x|) */
+ if(__builtin_expect(ix<0x30800000, 0)) {
+ /* |x|<2**-30, return -log(|x|) */
if(hx<0) {
*signgamp = -1;
return -__ieee754_logf(-x);
diff --git a/libc/sysdeps/ieee754/k_standard.c b/libc/sysdeps/ieee754/k_standard.c
index 150921f90..4a0d82d1a 100644
--- a/libc/sysdeps/ieee754/k_standard.c
+++ b/libc/sysdeps/ieee754/k_standard.c
@@ -31,7 +31,7 @@ static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $
#endif /* !defined(_USE_WRITE) */
/* XXX gcc versions until now don't delay the 0.0/0.0 division until
- runtime but produce NaN at copile time. This is wrong since the
+ runtime but produce NaN at compile time. This is wrong since the
exceptions are not set correctly. */
#if 0
static const double zero = 0.0; /* used as const */
diff --git a/libc/sysdeps/ieee754/ldbl-128/e_expl.c b/libc/sysdeps/ieee754/ldbl-128/e_expl.c
index 589f957c2..23c204ce0 100644
--- a/libc/sysdeps/ieee754/ldbl-128/e_expl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/e_expl.c
@@ -117,7 +117,7 @@ static const long double C[] = {
#define TWO15 C[11]
32768.0L,
-/* Chebyshev polynom coeficients for (exp(x)-1)/x */
+/* Chebyshev polynom coefficients for (exp(x)-1)/x */
#define P1 C[12]
#define P2 C[13]
#define P3 C[14]
diff --git a/libc/sysdeps/ieee754/ldbl-128/strtold_l.c b/libc/sysdeps/ieee754/ldbl-128/strtold_l.c
index 8e0bc0319..d3a1d1e86 100644
--- a/libc/sysdeps/ieee754/ldbl-128/strtold_l.c
+++ b/libc/sysdeps/ieee754/ldbl-128/strtold_l.c
@@ -34,11 +34,13 @@
#define SET_MANTISSA(flt, mant) \
do { union ieee854_long_double u; \
u.d = (flt); \
- u.ieee.mantissa0 = 0x8000; \
- u.ieee.mantissa1 = 0; \
- u.ieee.mantissa2 = ((mant) >> 32); \
- u.ieee.mantissa3 = (mant) & 0xffffffff; \
- (flt) = u.d; \
+ u.ieee_nan.mantissa0 = 0; \
+ u.ieee_nan.mantissa1 = 0; \
+ u.ieee_nan.mantissa2 = (mant) >> 32; \
+ u.ieee_nan.mantissa3 = (mant); \
+ if ((u.ieee.mantissa0 | u.ieee.mantissa1 \
+ | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
+ (flt) = u.d; \
} while (0)
#include <strtod_l.c>
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c
index b599f369a..1b994cd7a 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_expl.c
@@ -116,7 +116,7 @@ static const long double C[] = {
#define TWO15 C[11]
32768.0L,
-/* Chebyshev polynom coeficients for (exp(x)-1)/x */
+/* Chebyshev polynom coefficients for (exp(x)-1)/x */
#define P1 C[12]
#define P2 C[13]
#define P3 C[14]
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h
index e5644f5d3..9e94f53b0 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/ieee754.h
@@ -199,6 +199,25 @@ union ibm_extended_long_double
unsigned int mantissa2:20;
unsigned int mantissa3:32;
} ieee;
+
+ /* This format makes it easier to see if a NaN is a signalling NaN. */
+ struct
+ { /* Big endian. There is no other. */
+
+ unsigned int negative:1;
+ unsigned int exponent:11;
+ unsigned int quiet_nan:1;
+ /* Together Mantissa0-3 comprise the mantissa. */
+ unsigned int mantissa0:19;
+ unsigned int mantissa1:32;
+
+ unsigned int negative2:1;
+ unsigned int exponent2:11;
+ /* There is an implied 1 here? */
+ /* Together these comprise the mantissa. */
+ unsigned int mantissa2:20;
+ unsigned int mantissa3:32;
+ } ieee_nan;
};
#define IBM_EXTENDED_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c
index 3b4af5423..a344e9288 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c
@@ -24,9 +24,7 @@
__complex__ long double
__cprojl (__complex__ long double x)
{
- if (isnan (__real__ x) && isnan (__imag__ x))
- return x;
- else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+ if (__isinf_nsl (__real__ x) || __isinf_nsl (__imag__ x))
{
__complex__ long double res;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
index 93415f0f0..04e328857 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
@@ -44,11 +44,10 @@ libc_hidden_proto (STRTOF)
# define SET_MANTISSA(flt, mant) \
do { union ibm_extended_long_double u; \
u.d = (flt); \
- if ((mant & 0xfffffffffffffULL) == 0) \
- mant = 0x8000000000000ULL; \
- u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff; \
- u.ieee.mantissa1 = (mant) & 0xffffffff; \
- (flt) = u.d; \
+ u.ieee_nan.mantissa0 = (mant) >> 32; \
+ u.ieee_nan.mantissa1 = (mant); \
+ if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
+ (flt) = u.d; \
} while (0)
#include <strtod_l.c>
diff --git a/libc/sysdeps/ieee754/ldbl-64-128/strtold_l.c b/libc/sysdeps/ieee754/ldbl-64-128/strtold_l.c
index 8182b2bcd..e9b33f2d8 100644
--- a/libc/sysdeps/ieee754/ldbl-64-128/strtold_l.c
+++ b/libc/sysdeps/ieee754/ldbl-64-128/strtold_l.c
@@ -44,11 +44,13 @@ libc_hidden_proto (STRTOF)
#define SET_MANTISSA(flt, mant) \
do { union ieee854_long_double u; \
u.d = (flt); \
- u.ieee.mantissa0 = 0x8000; \
- u.ieee.mantissa1 = 0; \
- u.ieee.mantissa2 = ((mant) >> 32); \
- u.ieee.mantissa3 = (mant) & 0xffffffff; \
- (flt) = u.d; \
+ u.ieee_nan.mantissa0 = 0; \
+ u.ieee_nan.mantissa1 = 0; \
+ u.ieee_nan.mantissa2 = (mant) >> 32; \
+ u.ieee_nan.mantissa3 = (mant); \
+ if ((u.ieee.mantissa0 | u.ieee.mantissa1 \
+ | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
+ (flt) = u.d; \
} while (0)
#include <strtod_l.c>
diff --git a/libc/sysdeps/ieee754/ldbl-96/strtold_l.c b/libc/sysdeps/ieee754/ldbl-96/strtold_l.c
index ded84f342..dccf98c46 100644
--- a/libc/sysdeps/ieee754/ldbl-96/strtold_l.c
+++ b/libc/sysdeps/ieee754/ldbl-96/strtold_l.c
@@ -34,11 +34,10 @@
#define SET_MANTISSA(flt, mant) \
do { union ieee854_long_double u; \
u.d = (flt); \
- if ((mant & 0x7fffffffffffffffULL) == 0) \
- mant = 0x4000000000000000ULL; \
- u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000; \
- u.ieee.mantissa1 = (mant) & 0xffffffff; \
- (flt) = u.d; \
+ u.ieee_nan.mantissa0 = (mant) >> 32; \
+ u.ieee_nan.mantissa1 = (mant); \
+ if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
+ (flt) = u.d; \
} while (0)
#include <stdlib/strtod_l.c>
diff --git a/libc/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h b/libc/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
index b0b863cba..af861c11e 100644
--- a/libc/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
+++ b/libc/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
@@ -10,7 +10,7 @@
SHLIB_COMPAT(lib, introduced, LONG_DOUBLE_COMPAT_VERSION)
#define long_double_symbol(lib, local, symbol) \
long_double_symbol_1 (lib, local, symbol, LONG_DOUBLE_COMPAT_VERSION)
-#if defined SHARED && defined DO_VERSIONING
+#ifdef SHARED
# define ldbl_hidden_def(local, name) libc_hidden_ver (local, name)
# define ldbl_strong_alias(name, aliasname) \
strong_alias (name, __GL_##name##_##aliasname) \