This is the mail archive of the libc-alpha@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]

Add lround test for bug 2561


Bug 2561 reported a problem with lround that turns out to have been
fixed by

commit 7f5517aa5269af6cac791ca74111f817320b73f2
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Thu Sep 8 23:37:32 2011 -0400

    Fix lround() loses precision

(and also hidden for x86_64 by it not using this version of lround any
more).  However that commit added a test for llround (using TEST_f_l,
i.e. the macro for testing a "long" function, not "long long") to
test_lround, rather than adding a test for lround.  This patch moves
the test in question to the proper function, makes it use the correct
macro, and adds the testcase from bug 2561 to ensure it stays fixed.

This is obvious apart from the question of whether the "# if LONG_MAX
> 281474976710656" condition should change to use the new larger
number now in a test (or whether each of the tests with a larger
number should be in its own such conditional on LONG_MAX).

2012-02-23  Joseph Myers  <joseph@codesourcery.com>

	* math/libm-test.inc (llround_test): Move one test from
	lround_test.  Use TEST_f_L in moved test.
	(lround_test): Move misplaced test to llround_test.  Add testcase
	from bug 2561.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 6243e1e..3398c69 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -4395,7 +4395,7 @@ lround_test (void)
   TEST_f_l (lround, 1073741824.01, 1073741824);
 # if LONG_MAX > 281474976710656
   TEST_f_l (lround, 281474976710656.025, 281474976710656);
-  TEST_f_l (llround, -3.65309740835E17, -365309740835000000);
+  TEST_f_l (lround, 18014398509481974, 18014398509481974);
 # endif
   TEST_f_l (lround, 2097152.5, 2097153);
   TEST_f_l (lround, -2097152.5, -2097153);
@@ -4438,6 +4438,7 @@ llround_test (void)
   TEST_f_L (llround, -2097152.5, -2097153);
   TEST_f_L (llround, 34359738368.5, 34359738369ll);
   TEST_f_L (llround, -34359738368.5, -34359738369ll);
+  TEST_f_L (llround, -3.65309740835E17, -365309740835000000LL);
 #endif
 
   /* Test boundary conditions.  */

-- 
Joseph S. Myers
joseph@codesourcery.com


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