This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/887] Math library function "logb" and "nextafter" inconsistent


http://sourceware.org/bugzilla/show_bug.cgi?id=887

--- Comment #19 from Ryan S. Arnold <rsa at us dot ibm.com> 2012-03-26 17:43:26 UTC ---
Testing the following as a preliminary patch:

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 3851855..ea50e63 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -5000,6 +5000,39 @@ logb_test (void)
   END (logb);
 }

+static void
+logb_test_downward (void)
+{
+  int save_round_mode;
+  errno = 0;
+
+  FUNC(logb) (0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
+  START (logb_downward);
+
+  save_round_mode = fegetround ();
+
+  if (!fesetround (FE_DOWNWARD))
+    {
+
+      /* IEEE 754-2008 says (section 5.3.3) that "logB(1) is +0.".  Libm
+       * should not return -0 from logb in any rounding mode.  PowerPC32 is
+       * known to fail with this test for power4 and earlier hardware due
+       * the instructions available for the logb computation at the POWER4
+       * and earlier ISA level.  POWER4 uses an fsub in the calculation which
+       * propogates a negative sign in a downward rounding mode.  */
+
+      /* BZ #887 .*/
+      TEST_f_f (logb, 1.000e+0, plus_zero);
+    }
+
+  fesetround (save_round_mode);
+
+  END (logb_downward);
+}

 static void
 lround_test (void)
@@ -7834,6 +7867,7 @@ main (int argc, char **argv)
   log1p_test ();
   log2_test ();
   logb_test ();
+  logb_test_downward ();
   modf_test ();
   ilogb_test ();
   scalb_test ();

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]