From af0498dc955f23c4e2eb28b1658ec2e86b4ab069 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 24 Mar 2008 19:57:55 +0000 Subject: [BZ #5857] 2008-03-09 Andreas Jaeger [BZ #5857] * sysdeps/ieee754/dbl-64/s_rint.c (__rint): Handle j0==18. * sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Likewise. Patch by Mark Elliott . * math/libm-test.inc (nearbyint_test): Add new test cases from #5857. (rint_test): Likewise. --- sysdeps/ieee754/dbl-64/s_nearbyint.c | 9 ++++++++- sysdeps/ieee754/dbl-64/s_rint.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/ieee754/dbl-64/s_nearbyint.c b/sysdeps/ieee754/dbl-64/s_nearbyint.c index 32f5bf9447..71e14cfb6d 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 e5f241291c..4e6381efbe 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) { -- cgit 1.4.1