diff options
author | Ryan S. Arnold <rsa@linux.vnet.ibm.com> | 2012-04-27 10:47:39 -0500 |
---|---|---|
committer | Ryan S. Arnold <rsa@linux.vnet.ibm.com> | 2012-04-27 10:47:39 -0500 |
commit | a462cb63326595eb018e26ea415f8ddc1ed50730 (patch) | |
tree | 89a1ee94b2ebd0e3355bab5c83a8445b5f6f060c /math | |
parent | 6ad3493e2247e6cb3c9e086e8cb1f8b51a5f27d6 (diff) | |
download | glibc-a462cb63326595eb018e26ea415f8ddc1ed50730.tar glibc-a462cb63326595eb018e26ea415f8ddc1ed50730.tar.gz glibc-a462cb63326595eb018e26ea415f8ddc1ed50730.tar.bz2 glibc-a462cb63326595eb018e26ea415f8ddc1ed50730.zip |
New test to expose erroneous negative sign on logb(1) (bug 887).
Diffstat (limited to 'math')
-rw-r--r-- | math/libm-test.inc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index e0ac6131da..d11cd1ff86 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -5101,6 +5101,40 @@ 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 has + failed with this test for power4 logb (and logbl on all PowerPC + platforms) in the past due to instruction selection. GCC PR 52775 + provides the availability of the fcfid insn in 32-bit mode which + eliminates the use of fsub in this instance and prevents the negative + signed 0.0. */ + + /* BZ #887 .*/ + TEST_f_f (logb, 1.000e+0, plus_zero); + } + + fesetround (save_round_mode); + + END (logb_downward); +} static void lround_test (void) @@ -8210,6 +8244,7 @@ main (int argc, char **argv) log1p_test (); log2_test (); logb_test (); + logb_test_downward (); modf_test (); ilogb_test (); scalb_test (); |