summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-05 19:19:20 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-05 19:19:20 +0000
commit29132b91519572e6076003735cd6f718ff2e1369 (patch)
tree99ce33e32f1bf5e86d5a68639650498648face1c /sysdeps/ieee754
parent350b053ae97f0764a5910fbf4fc168cb1216efbd (diff)
Update.
* iconvdata/ibm1129.h: Remove duplicate mappings. * iconvdata/ibm937.c: Handle overflow errors. Handle new tables. * iconvdata/ibm937.h: Reorganize table to safe a lot of space. Patch by Masahide Washizawa <WASHI@jp.ibm.com>. * timezone/zic.c: Fix handling of turnaround times. Patch by Arthur David Olson <olsona@dc37a.nci.nih.gov>. 2001-12-02 Moshe Olshansky <OLSHANSK@il.ibm.com> * sysdeps/ieee754/dbl-64/e_remainder.c (__ieee754_remainder): Fix overflow problem. 2001-12-05 Ulrich Drepper <drepper@redhat.com> * posix/regex.c: For use outside glibc defined bounded pointer macros here. Patch by Jim Meyering <jim@meyering.net>.
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/dbl-64/e_remainder.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c
index 9c82ae7dfc..2001321ecc 100644
--- a/sysdeps/ieee754/dbl-64/e_remainder.c
+++ b/sysdeps/ieee754/dbl-64/e_remainder.c
@@ -55,8 +55,8 @@ double __ieee754_remainder(double x, double y)
kx=u.i[HIGH_HALF]&0x7fffffff; /* no sign for x*/
t.i[HIGH_HALF]&=0x7fffffff; /*no sign for y */
ky=t.i[HIGH_HALF];
- /*------ |x| < 2^1024 and 2^-970 < |y| < 2^1024 ------------------*/
- if (kx<0x7ff00000 && ky<0x7ff00000 && ky>=0x03500000) {
+ /*------ |x| < 2^1023 and 2^-970 < |y| < 2^1024 ------------------*/
+ if (kx<0x7fe00000 && ky<0x7ff00000 && ky>=0x03500000) {
if (kx+0x00100000<ky) return x;
if ((kx-0x01500000)<ky) {
z=x/t.x;
@@ -100,14 +100,22 @@ double __ieee754_remainder(double x, double y)
{z=u.x/t.x; d=(z+big.x)-big.x; return ((u.x-d*w.x)-d*ww.x);}
}
- } /* (kx<0x7ff00000&&ky<0x7ff00000&&ky>=0x03500000) */
+ } /* (kx<0x7fe00000&&ky<0x7ff00000&&ky>=0x03500000) */
else {
- if (kx<0x7ff00000&&ky<0x7ff00000&&(ky>0||t.i[LOW_HALF]!=0)) {
+ if (kx<0x7fe00000&&ky<0x7ff00000&&(ky>0||t.i[LOW_HALF]!=0)) {
y=ABS(y)*t128.x;
z=__ieee754_remainder(x,y)*t128.x;
z=__ieee754_remainder(z,y)*tm128.x;
return z;
}
+ else {
+ if ((kx&0x7ff00000)==0x7fe00000&&ky<0x7ff00000&&(ky>0||t.i[LOW_HALF]!=0)) {
+ y=ABS(y);
+ z=2.0*__ieee754_remainder(0.5*x,y);
+ d = ABS(z);
+ if (d <= ABS(d-y)) return z;
+ else return (z>0)?z-y:z+y;
+ }
else { /* if x is too big */
if (kx == 0x7ff00000 && u.i[LOW_HALF] == 0 && y == 1.0)
return x / x;
@@ -116,5 +124,6 @@ double __ieee754_remainder(double x, double y)
return (u.i[HIGH_HALF]&0x80000000)?nNAN.x:NAN.x;
else return x;
}
+ }
}
}