diff options
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_nearbyint.c | 9 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_rint.c | 11 |
2 files changed, 17 insertions, 3 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/s_nearbyint.c index 32f5bf9..71e14cf 100644 --- a/sysdeps/ieee754/dbl-64/s_nearbyint.c +++ b/sysdeps/ieee754/dbl-64/s_nearbyint.c @@ -71,8 +71,15 @@ TWO52[2]={ if(((i0&i)|i1)==0) return x; /* x is integral */ i>>=1; if(((i0&i)|i1)!=0) { - if(j0==19) i1 = 0x40000000; else + if (j0==19) + i1 = 0x40000000; + else if (j0<18) i0 = (i0&(~i))|((0x20000)>>j0); + else + { + i0 &= ~i; + i1 = 0x80000000; + } } } } else if (j0>51) { diff --git a/sysdeps/ieee754/dbl-64/s_rint.c b/sysdeps/ieee754/dbl-64/s_rint.c index e5f2412..4e6381e 100644 --- a/sysdeps/ieee754/dbl-64/s_rint.c +++ b/sysdeps/ieee754/dbl-64/s_rint.c @@ -67,8 +67,15 @@ TWO52[2]={ if(((i0&i)|i1)==0) return x; /* x is integral */ i>>=1; if(((i0&i)|i1)!=0) { - if(j0==19) i1 = 0x40000000; else - i0 = (i0&(~i))|((0x20000)>>j0); + if (j0==19) + i1 = 0x40000000; + else if (j0<18) + i0 = (i0&(~i))|((0x20000)>>j0); + else + { + i0 &= ~i; + i1 = 0x80000000; + } } } } else if (j0>51) { |