[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r18966 - in /fsf/trunk/libc: ./ sysdeps/ieee754/ldbl-128ibm/ sysdeps/unix/sysv/linux/
- To: commits@xxxxxxxxxx
- Subject: [Commits] r18966 - in /fsf/trunk/libc: ./ sysdeps/ieee754/ldbl-128ibm/ sysdeps/unix/sysv/linux/
- From: eglibc@xxxxxxxxxx
- Date: Wed, 06 Jun 2012 00:01:37 -0000
Author: eglibc
Date: Wed Jun 6 00:01:36 2012
New Revision: 18966
Log:
Import glibc-mainline for 2012-06-06
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-getcpu.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Jun 6 00:01:36 2012
@@ -1,3 +1,20 @@
+2012-06-05 Adhemerval Zanella <azanella@xxxxxxxxxxxxxxxxxx>
+
+ * sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Fix spurious underflow for
+ values higher than 25.6283.
+
+2012-06-04 Adhemerval Zanella <azanella@xxxxxxxxxxxxxxxxxx>
+
+ * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Fix
+ subnormal exponent extraction and add some __builtin_expect.
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_extract_mantissa):
+ Fix for subnormal mantissa calculation.
+
+2012-06-04 Mike Frysinger <vapier@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/tst-getcpu.c (do_test): Call perror when
+ cpu2 is -1 and errno is not ENOSYS.
+
2012-06-04 H.J. Lu <hongjiu.lu@xxxxxxxxx>
[BZ #14117]
Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c Wed Jun 6 00:01:36 2012
@@ -27,8 +27,8 @@
long double
__ieee754_fmodl (long double x, long double y)
{
- int64_t n,hx,hy,hz,ix,iy,sx,i;
- u_int64_t lx,ly,lz;
+ int64_t n,hx,hy,hz,ix,iy,sx;
+ u_int64_t lx,ly,lz, i;
int temp;
GET_LDOUBLE_WORDS64(hx,lx,x);
@@ -38,41 +38,42 @@
hy &= 0x7fffffffffffffffLL; /* |y| */
/* purge off exception values */
- if((hy|(ly&0x7fffffffffffffff))==0||(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
- (hy>0x7ff0000000000000LL)) /* or y is NaN */
+ if(__builtin_expect((hy|(ly&0x7fffffffffffffff))==0 ||
+ (hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
+ (hy>0x7ff0000000000000LL),0)) /* or y is NaN */
return (x*y)/(x*y);
- if(hx<=hy) {
+ if(__builtin_expect(hx<=hy,0)) {
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
if(lx==ly)
return Zero[(u_int64_t)sx>>63]; /* |x|=|y| return x*0*/
}
/* determine ix = ilogb(x) */
- if(hx<0x0010000000000000LL) { /* subnormal x */
+ if(__builtin_expect(hx<0x0010000000000000LL,0)) { /* subnormal x */
if(hx==0) {
for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
} else {
- for (ix = -1022, i=hx<<19; i>0; i<<=1) ix -=1;
+ for (ix = -1022, i=(hx<<11); i>0; i<<=1) ix -=1;
}
} else ix = (hx>>52)-0x3ff;
/* determine iy = ilogb(y) */
- if(hy<0x0010000000000000LL) { /* subnormal y */
+ if(__builtin_expect(hy<0x0010000000000000LL,0)) { /* subnormal y */
if(hy==0) {
for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
} else {
- for (iy = -1022, i=hy<<19; i>0; i<<=1) iy -=1;
+ for (iy = -1022, i=(hy<<11); i>0; i<<=1) iy -=1;
}
} else iy = (hy>>52)-0x3ff;
/* Make the IBM extended format 105 bit mantissa look like the ieee854 112
- bit mantissa so the following operatations will give the correct
+ bit mantissa so the following operations will give the correct
result. */
ldbl_extract_mantissa(&hx, &lx, &temp, x);
ldbl_extract_mantissa(&hy, &ly, &temp, y);
/* set up {hx,lx}, {hy,ly} and align y to x */
- if(ix >= -1022)
+ if(__builtin_expect(ix >= -1022, 1))
hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx);
else { /* subnormal x, shift x to normal */
n = -1022-ix;
@@ -84,7 +85,7 @@
lx = 0;
}
}
- if(iy >= -1022)
+ if(__builtin_expect(iy >= -1022, 1))
hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy);
else { /* subnormal y, shift y to normal */
n = -1022-iy;
@@ -118,7 +119,7 @@
hx = hx+hx+(lx>>63); lx = lx+lx;
iy -= 1;
}
- if(iy>= -1022) { /* normalize output */
+ if(__builtin_expect(iy>= -1022,0)) { /* normalize output */
x = ldbl_insert_mantissa((sx>>63), iy, hx, lx);
} else { /* subnormal output */
n = -1022 - iy;
Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h Wed Jun 6 00:01:36 2012
@@ -6,20 +6,20 @@
#include <ieee754.h>
static inline void
-ldbl_extract_mantissa (int64_t *hi64, u_int64_t *lo64, int *exp, long double x)
+ldbl_extract_mantissa (int64_t *hi64, uint64_t *lo64, int *exp, long double x)
{
/* We have 105 bits of mantissa plus one implicit digit. Since
106 bits are representable we use the first implicit digit for
the number before the decimal point and the second implicit bit
as bit 53 of the mantissa. */
- unsigned long long hi, lo;
+ uint64_t hi, lo;
int ediff;
union ibm_extended_long_double eldbl;
eldbl.d = x;
*exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
- lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
- hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
+ lo = ((int64_t)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
+ hi = ((int64_t)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
/* If the lower double is not a denomal or zero then set the hidden
53rd bit. */
if (eldbl.ieee.exponent2 > 0x001)
@@ -31,8 +31,8 @@
ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
if (ediff > 53)
lo = lo >> (ediff-53);
+ hi |= (1ULL << 52);
}
- hi |= (1ULL << 52);
if ((eldbl.ieee.negative != eldbl.ieee.negative2)
&& ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_erfl.c Wed Jun 6 00:01:36 2012
@@ -72,6 +72,8 @@
* z=1/x^2
* The interval is partitioned into several segments
* of width 1/8 in 1/x.
+ * erf(x) = 1.0 - erfc(x) if x < 25.6283 else
+ * erf(x) = sign(x)*(1.0 - tiny)
*
* Note1:
* To compute exp(-x*x-0.5625+R/S), let s be a single
@@ -84,6 +86,9 @@
* exp(-x*x)
* erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
* x*sqrt(pi)
+ *
+ * Note3:
+ * For x higher than 25.6283, erf(x) underflows.
*
* 5. For inf > x >= 107
* erf(x) = sign(x) *(1 - tiny) (raise inexact)
@@ -770,9 +775,19 @@
if (ix >= 0x3ff00000) /* |x| >= 1.0 */
{
- y = __erfcl (x);
- return (one - y);
- /* return (one - __erfcl (x)); */
+ if (ix >= 0x4039A0DE)
+ {
+ /* __erfcl (x) underflows if x > 25.6283 */
+ if (sign)
+ return one-tiny;
+ else
+ return tiny-one;
+ }
+ else
+ {
+ y = __erfcl (x);
+ return (one - y);
+ }
}
u.parts32.w0 = ix;
a = u.value;
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-getcpu.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-getcpu.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-getcpu.c Wed Jun 6 00:01:36 2012
@@ -31,10 +31,15 @@
else
{
int cpu2 = sched_getcpu ();
- if (cpu2 == -1 && errno == ENOSYS)
+ if (cpu2 == -1)
{
- puts ("getcpu syscall not implemented");
- return 0;
+ if (errno == ENOSYS)
+ {
+ puts ("getcpu syscall not implemented");
+ return 0;
+ }
+ perror ("getcpu failed");
+ result = 1;
}
if (cpu2 != cpu)
{
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits