aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rw-r--r--soft-fp/op-4.h2
-rw-r--r--stdio-common/printf_fp.c3
-rw-r--r--sysdeps/ieee754/ldbl-128/e_gammal_r.c8
-rw-r--r--sysdeps/ieee754/ldbl-128/e_j0l.c12
-rw-r--r--sysdeps/ieee754/ldbl-128/e_lgammal_r.c8
-rw-r--r--sysdeps/ieee754/ldbl-128/e_log10l.c15
-rw-r--r--sysdeps/ieee754/ldbl-128/e_log2l.c15
-rw-r--r--sysdeps/ieee754/ldbl-128/e_powl.c7
-rw-r--r--sysdeps/ieee754/ldbl-128/ldbl2mpn.c16
-rw-r--r--sysdeps/ieee754/ldbl-128/s_erfl.c8
-rw-r--r--sysdeps/ieee754/ldbl-128/s_expm1l.c3
-rw-r--r--sysdeps/ieee754/ldbl-128/s_log1pl.c17
-rw-r--r--sysdeps/ieee754/ldbl-128/s_remquol.c6
14 files changed, 96 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ab81718c6..2f95a048f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2002-07-03 Jakub Jelinek <jakub@redhat.com>
+
+ * stdio-common/printf_fp.c (__printf_fp.c): If _FPIO_CONST_SHIFT is
+ non-zero, adjust exponent.
+ * sysdeps/ieee754/ldbl-128/s_erfl.c (__erfl, erfl, __erfcl, erfcl):
+ Remove NO_LONG_DOUBLE aliases.
+ * sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l, expm1l): Likewise.
+ * sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl, log1pl): Likewise.
+ (__log1pl): Raise divide by zero and invalid exceptions when needed.
+ * sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Special case
+ 1**y and -1**+-Inf.
+ * sysdeps/ieee754/ldbl-128/ldbl2mpn.c (__mpn_extract_long_double):
+ Fix BITS_PER_MP_LIMB 32 extraction.
+ * sysdeps/ieee754/ldbl-128/e_log2l.c (__ieee754_log2l): Don't raise
+ exceptions for qNaNs.
+ * sysdeps/ieee754/ldbl-128/e_log10l.c (__ieee754_log10l): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_lgammal_r.c (__ieee754_lgamma_r):
+ Raise exceptions when needed. Don't recurse unnecessarily.
+ Special case 1.0L and 2.0L arguments to avoid -0.0L as result.
+ * sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_y0l): Don't raise
+ exceptions for qNaNs.
+ * sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Make qs 64-bit
+ to fix *quo return value sign.
+ * sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gamma_r): Special
+ case -Inf argument.
+ * soft-fp/op-4.h (_FP_FRAC_CLZ_4): Fix a pasto.
+
+2002-07-01 Jakub Jelinek <jakub@redhat.com>
+
+ * libio/tst-eof.c (do_test): Remove unused ch and tm variables.
+ * iconvdata/iso-2022-jp-3.c (EMIT_SHIFT_TO_INIT): Kill warnings if
+ -DNDEBUG.
+
2002-07-10 Ulrich Drepper <drepper@redhat.com>
* malloc/hooks.c (realloc_check): If mremap succeeds actually use
diff --git a/soft-fp/op-4.h b/soft-fp/op-4.h
index 5e3032e44a..bbfd433a86 100644
--- a/soft-fp/op-4.h
+++ b/soft-fp/op-4.h
@@ -167,7 +167,7 @@
} \
else if (X##_f[1]) \
{ \
- __FP_CLZ(R,X##_f[2]); \
+ __FP_CLZ(R,X##_f[1]); \
R += _FP_W_TYPE_SIZE*2; \
} \
else \
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 974a1f09c0..e265fe90c4 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -494,6 +494,9 @@ __printf_fp (FILE *fp,
&__tens[powers->arrayoff],
tmpsize * sizeof (mp_limb_t));
MPN_ZERO (tmp, _FPIO_CONST_SHIFT);
+ /* Adjust exponent, as scaleexpo will be this much
+ bigger too. */
+ exponent += _FPIO_CONST_SHIFT * BITS_PER_MP_LIMB;
}
else
#endif
diff --git a/sysdeps/ieee754/ldbl-128/e_gammal_r.c b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
index 6f0d4b7287..123b559d08 100644
--- a/sysdeps/ieee754/ldbl-128/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_gammal_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
Jakub Jelinek <jj@ultra.linux.cz, 1999.
@@ -46,6 +46,12 @@ __ieee754_gammal_r (long double x, int *signgamp)
*signgamp = 0;
return (x - x) / (x - x);
}
+ if (hx == 0xffff000000000000ULL && lx == 0)
+ {
+ /* x == -Inf. According to ISO this is NaN. */
+ *signgamp = 0;
+ return x - x;
+ }
/* XXX FIXME. */
return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c
index dbe414d2b1..ce506076d1 100644
--- a/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -803,12 +803,6 @@ long double
{
long double xx, xinv, z, p, q, c, s, cc, ss;
- if (x <= 0.0L)
- {
- if (x < 0.0L)
- return (zero / zero);
- return 1.0L / zero;
- }
if (! finitel (x))
{
if (x != x)
@@ -816,6 +810,12 @@ long double
else
return 0.0L;
}
+ if (x <= 0.0L)
+ {
+ if (x < 0.0L)
+ return (zero / zero);
+ return 1.0L / zero;
+ }
xx = fabsl (x);
if (xx <= 2.0L)
{
diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
index b13ca91c3f..81c20595c2 100644
--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
@@ -761,10 +761,9 @@ __ieee754_lgammal_r (x, signgamp)
if (x < 0.0L)
{
q = -x;
- w = __ieee754_lgammal_r (q, &i);
p = __floorl (q);
if (p == q)
- return (one / zero);
+ return (one / (p - p));
i = p;
if ((i & 1) == 0)
*signgamp = -1;
@@ -779,6 +778,7 @@ __ieee754_lgammal_r (x, signgamp)
z = q * __sinl (PIL * z);
if (z == 0.0L)
return (*signgamp * huge * huge);
+ w = __ieee754_lgammal_r (q, &i);
z = __logl (PIL / z) - w;
return (z);
}
@@ -859,6 +859,8 @@ __ieee754_lgammal_r (x, signgamp)
z = x - 1.0L;
p = z * neval (z, RNr9, NRNr9) / deval (z, RDr9, NRDr9);
}
+ else if (x == 1.0L)
+ p = 0.0L;
else if (x <= 1.125L)
{
z = x - 1.0L;
@@ -900,6 +902,8 @@ __ieee754_lgammal_r (x, signgamp)
p += lgam1r75b;
p += lgam1r75a;
}
+ else if (x == 2.0L)
+ p = 0.0L;
else if (x < 2.375L)
{
z = x - 2.0L;
diff --git a/sysdeps/ieee754/ldbl-128/e_log10l.c b/sysdeps/ieee754/ldbl-128/e_log10l.c
index bc2af9d850..efdcdbbe5c 100644
--- a/sysdeps/ieee754/ldbl-128/e_log10l.c
+++ b/sysdeps/ieee754/ldbl-128/e_log10l.c
@@ -170,16 +170,15 @@ __ieee754_log10l (x)
long double z;
long double y;
int e;
+ int64_t hx, lx;
/* Test for domain */
- if (x <= 0.0L)
- {
- if (x == 0.0L)
- return (-1.0L / (x - x));
- else
- return (x - x) / (x - x);
- }
- if (!__finitel (x))
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if (((hx & 0x7fffffffffffffffLL) | lx) == 0)
+ return (-1.0L / (x - x));
+ if (hx < 0)
+ return (x - x) / (x - x);
+ if (hx >= 0x7fff000000000000LL)
return (x + x);
/* separate mantissa from exponent */
diff --git a/sysdeps/ieee754/ldbl-128/e_log2l.c b/sysdeps/ieee754/ldbl-128/e_log2l.c
index 5f887a5e23..ad408fcf33 100644
--- a/sysdeps/ieee754/ldbl-128/e_log2l.c
+++ b/sysdeps/ieee754/ldbl-128/e_log2l.c
@@ -164,16 +164,15 @@ __ieee754_log2l (x)
long double z;
long double y;
int e;
+ int64_t hx, lx;
/* Test for domain */
- if (x <= 0.0L)
- {
- if (x == 0.0L)
- return (-1.0L / (x - x));
- else
- return (x - x) / (x - x);
- }
- if (!__finitel (x))
+ GET_LDOUBLE_WORDS64 (hx, lx, x);
+ if (((hx & 0x7fffffffffffffffLL) | lx) == 0)
+ return (-1.0L / (x - x));
+ if (hx < 0)
+ return (x - x) / (x - x);
+ if (hx >= 0x7fff000000000000LL)
return (x + x);
/* separate mantissa from exponent */
diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c
index 6d5b9d52d2..79644f696c 100644
--- a/sysdeps/ieee754/ldbl-128/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128/e_powl.c
@@ -156,6 +156,13 @@ __ieee754_powl (x, y)
if ((iy | q.parts32.w1 | q.parts32.w2 | q.parts32.w3) == 0)
return one;
+ /* 1.0**y = 1; -1.0**+-Inf = 1 */
+ if (x == one)
+ return one;
+ if (x == -1.0L && iy == 0x7fff0000
+ && (q.parts32.w1 | q.parts32.w2 | q.parts32.w3) == 0)
+ return one;
+
/* +-NaN return x+y */
if ((ix > 0x7fff0000)
|| ((ix == 0x7fff0000)
diff --git a/sysdeps/ieee754/ldbl-128/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c
index 08a4c37a51..cdd09db69f 100644
--- a/sysdeps/ieee754/ldbl-128/ldbl2mpn.c
+++ b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c
@@ -102,7 +102,7 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
#else
int j, k, l;
- for (j = N - 1; j > 0; j++)
+ for (j = N - 1; j > 0; j--)
if (res_ptr[j] != 0)
break;
@@ -112,20 +112,22 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
if (cnt < 0)
{
cnt += BITS_PER_MP_LIMB;
- l++;
+ l--;
}
if (!cnt)
for (k = N - 1; k >= l; k--)
res_ptr[k] = res_ptr[k-l];
else
- for (k = N - 1; k >= l; k--)
- res_ptr[k] = res_ptr[k-l] << cnt
- | res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt);
- res_ptr[k--] = res_ptr[0] << cnt;
+ {
+ for (k = N - 1; k > l; k--)
+ res_ptr[k] = res_ptr[k-l] << cnt
+ | res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt);
+ res_ptr[k--] = res_ptr[0] << cnt;
+ }
for (; k >= 0; k--)
res_ptr[k] = 0;
- *expt = LDBL_MIN_EXP - 1 - 3 * BITS_PER_MP_LIMB - cnt;
+ *expt = LDBL_MIN_EXP - 1 - l * BITS_PER_MP_LIMB - cnt;
#endif
}
}
diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
index ef8eea6875..0955f420bb 100644
--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
@@ -790,10 +790,6 @@ __erfl (x)
}
weak_alias (__erfl, erfl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erf, __erfl)
-weak_alias (__erf, erfl)
-#endif
#ifdef __STDC__
long double
__erfcl (long double x)
@@ -935,7 +931,3 @@ weak_alias (__erf, erfl)
}
weak_alias (__erfcl, erfcl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erfc, __erfcl)
-weak_alias (__erfc, erfcl)
-#endif
diff --git a/sysdeps/ieee754/ldbl-128/s_expm1l.c b/sysdeps/ieee754/ldbl-128/s_expm1l.c
index 1ed68d6e34..6afe61702a 100644
--- a/sysdeps/ieee754/ldbl-128/s_expm1l.c
+++ b/sysdeps/ieee754/ldbl-128/s_expm1l.c
@@ -144,6 +144,3 @@ __expm1l (long double x)
}
weak_alias (__expm1l, expm1l)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__expm1, __expm1l) weak_alias (__expm1, expm1l)
-#endif
diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
index 73e9501330..9adc786034 100644
--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
+++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
@@ -117,17 +117,18 @@ __log1pl (long double xm1)
{
long double x, y, z, r, s;
ieee854_long_double_shape_type u;
- int32_t ix;
+ int32_t hx;
int e;
/* Test for NaN or infinity input. */
u.value = xm1;
- ix = u.parts32.w0 & 0x7fffffff;
- if (ix >= 0x7fff0000)
+ hx = u.parts32.w0;
+ if (hx >= 0x7fff0000)
return xm1;
/* log1p(+- 0) = +- 0. */
- if ((ix == 0) && (u.parts32.w1 | u.parts32.w2 | u.parts32.w3) == 0)
+ if (((hx & 0x7fffffff) == 0)
+ && (u.parts32.w1 | u.parts32.w2 | u.parts32.w3) == 0)
return xm1;
x = xm1 + 1.0L;
@@ -136,9 +137,9 @@ __log1pl (long double xm1)
if (x <= 0.0L)
{
if (x == 0.0L)
- return (-1.0L / zero);
+ return (-1.0L / (x - x));
else
- return (zero / zero);
+ return (zero / (x - x));
}
/* Separate mantissa from exponent. */
@@ -238,7 +239,3 @@ __log1pl (long double xm1)
}
weak_alias (__log1pl, log1pl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__log1p, __log1pl)
-weak_alias (__log1p, log1pl)
-#endif
diff --git a/sysdeps/ieee754/ldbl-128/s_remquol.c b/sysdeps/ieee754/ldbl-128/s_remquol.c
index a30720bfa4..ae896c807f 100644
--- a/sysdeps/ieee754/ldbl-128/s_remquol.c
+++ b/sysdeps/ieee754/ldbl-128/s_remquol.c
@@ -1,5 +1,5 @@
/* Compute remainder and a congruent to the quotient.
- Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -31,8 +31,8 @@ long double
__remquol (long double x, long double y, int *quo)
{
int64_t hx,hy;
- u_int64_t sx,lx,ly;
- int cquo,qs;
+ u_int64_t sx,lx,ly,qs;
+ int cquo;
GET_LDOUBLE_WORDS64 (hx, lx, x);
GET_LDOUBLE_WORDS64 (hy, ly, y);