]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
[BZ #5857]
authorUlrich Drepper <drepper@redhat.com>
Mon, 24 Mar 2008 19:57:55 +0000 (19:57 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 24 Mar 2008 19:57:55 +0000 (19:57 +0000)
2008-03-09  Andreas Jaeger  <aj@suse.de>
[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 <mark.h.elliott@lmco.com>.

* math/libm-test.inc (nearbyint_test): Add new test cases from #5857.
(rint_test): Likewise.

ChangeLog
math/libm-test.inc
sysdeps/ieee754/dbl-64/s_nearbyint.c
sysdeps/ieee754/dbl-64/s_rint.c

index 6f72ccd38d04bb3de7f1bd0a86b21bb37a891914..80ee942ef7844cdd51ce3a4c544738ebc2dd8440 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-03-09  Andreas Jaeger  <aj@suse.de>
+
+       [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 <mark.h.elliott@lmco.com>.
+
+       * math/libm-test.inc (nearbyint_test): Add new test cases from #5857.
+       (rint_test): Likewise.
+
 2008-03-24  Ulrich Drepper  <drepper@redhat.com>
 
        * nis/nis_call.c (nis_server_cache_search): Save errno around stat
index e698923f4ebb7e3603bac151ddace4911cc8cfd3..a33a1828577e5406c12402e0a1102abfe2acbf6f 100644 (file)
@@ -4481,6 +4481,11 @@ nearbyint_test (void)
   TEST_f_f (nearbyint, -0.5, minus_zero);
   TEST_f_f (nearbyint, -1.5, -2.0);
 
+  TEST_f_f (nearbyint, 262144.75, 262145.0);
+  TEST_f_f (nearbyint, 262142.75, 262143.0);
+  TEST_f_f (nearbyint, 524286.75, 524287.0);
+  TEST_f_f (nearbyint, 524288.75, 524289.0);
+
   END (nearbyint);
 }
 
@@ -4852,6 +4857,10 @@ rint_test (void)
   TEST_f_f (rint, -0.1, -0.0);
   TEST_f_f (rint, -0.25, -0.0);
   TEST_f_f (rint, -0.625, -1.0);
+  TEST_f_f (rint, 262144.75, 262145.0);
+  TEST_f_f (rint, 262142.75, 262143.0);
+  TEST_f_f (rint, 524286.75, 524287.0);
+  TEST_f_f (rint, 524288.75, 524289.0);
 #ifdef TEST_LDOUBLE
   /* The result can only be represented in long double.  */
   TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
index 32f5bf9447285165548793c8a67c2d1920d8067d..71e14cfb6dc378aefb8ef573d25a05d6805fc648 100644 (file)
@@ -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) {
index e5f241291cabd40a1086ebf5aa865b2f5d97a8f6..4e6381efbe040146b518eba62a53534981453a4a 100644 (file)
@@ -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) {