diff options
Diffstat (limited to 'sysdeps/ieee754/ldbl-128')
-rw-r--r-- | sysdeps/ieee754/ldbl-128/e_hypotl.c | 11 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/e_jnl.c | 2 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/e_logl.c | 5 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/printf_fphex.c | 14 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_erfl.c | 13 |
5 files changed, 33 insertions, 12 deletions
diff --git a/sysdeps/ieee754/ldbl-128/e_hypotl.c b/sysdeps/ieee754/ldbl-128/e_hypotl.c index f5ab901e6a..01444cfb4e 100644 --- a/sysdeps/ieee754/ldbl-128/e_hypotl.c +++ b/sysdeps/ieee754/ldbl-128/e_hypotl.c @@ -89,6 +89,17 @@ __ieee754_hypotl(long double x, long double y) b *= t1; a *= t1; k -= 16382; + GET_LDOUBLE_MSW64 (ha, a); + GET_LDOUBLE_MSW64 (hb, b); + if (hb > ha) + { + t1 = a; + a = b; + b = t1; + j = ha; + ha = hb; + hb = j; + } } else { /* scale a and b by 2^9600 */ ha += 0x2580000000000000LL; /* a *= 2^9600 */ hb += 0x2580000000000000LL; /* b *= 2^9600 */ diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c index 70d5672fd9..c2a49235c3 100644 --- a/sysdeps/ieee754/ldbl-128/e_jnl.c +++ b/sysdeps/ieee754/ldbl-128/e_jnl.c @@ -316,7 +316,7 @@ __ieee754_ynl (int n, long double x) if (x <= 0.0L) { if (x == 0.0L) - return -HUGE_VALL + x; + return ((n < 0 && (n & 1) != 0) ? 1.0L : -1.0L) / 0.0L; if (se & 0x80000000) return zero / (zero * x); } diff --git a/sysdeps/ieee754/ldbl-128/e_logl.c b/sysdeps/ieee754/ldbl-128/e_logl.c index 395a76302a..3d1034dd61 100644 --- a/sysdeps/ieee754/ldbl-128/e_logl.c +++ b/sysdeps/ieee754/ldbl-128/e_logl.c @@ -212,9 +212,8 @@ __ieee754_logl(long double x) } /* Extract exponent and reduce domain to 0.703125 <= u < 1.40625 */ - e = (int) (m >> 16) - (int) 0x3ffe; - m &= 0xffff; - u.parts32.w0 = m | 0x3ffe0000; + u.value = __frexpl (x, &e); + m = u.parts32.w0 & 0xffff; m |= 0x10000; /* Find lookup table index k from high order bits of the significand. */ if (m < 0x16800) diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c index c9e09a4b74..e82228a53e 100644 --- a/sysdeps/ieee754/ldbl-128/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c @@ -24,13 +24,15 @@ do { \ digits we use only the implicit digits for the number before \ the decimal point. */ \ unsigned long long int num0, num1; \ + union ieee854_long_double u; \ + u.d = fpnum.ldbl; \ \ assert (sizeof (long double) == 16); \ \ - num0 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \ - | fpnum.ldbl.ieee.mantissa1); \ - num1 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa2) << 32 \ - | fpnum.ldbl.ieee.mantissa3); \ + num0 = (((unsigned long long int) u.ieee.mantissa0) << 32 \ + | u.ieee.mantissa1); \ + num1 = (((unsigned long long int) u.ieee.mantissa2) << 32 \ + | u.ieee.mantissa3); \ \ zero_mantissa = (num0|num1) == 0; \ \ @@ -75,9 +77,9 @@ do { \ *--wnumstr = L'0'; \ } \ \ - leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1'; \ + leading = u.ieee.exponent == 0 ? '0' : '1'; \ \ - exponent = fpnum.ldbl.ieee.exponent; \ + exponent = u.ieee.exponent; \ \ if (exponent == 0) \ { \ diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c index d9d4195ad2..ef65ed8922 100644 --- a/sysdeps/ieee754/ldbl-128/s_erfl.c +++ b/sysdeps/ieee754/ldbl-128/s_erfl.c @@ -96,6 +96,7 @@ * erfc/erf(NaN) is NaN */ +#include <errno.h> #include <math.h> #include <math_private.h> @@ -918,14 +919,22 @@ __erfcl (long double x) r = __ieee754_expl (-z * z - 0.5625) * __ieee754_expl ((z - x) * (z + x) + p); if ((sign & 0x80000000) == 0) - return r / x; + { + long double ret = r / x; + if (ret == 0) + __set_errno (ERANGE); + return ret; + } else return two - r / x; } else { if ((sign & 0x80000000) == 0) - return tiny * tiny; + { + __set_errno (ERANGE); + return tiny * tiny; + } else return two - tiny; } |