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]

[PATCHv2 07/14] Replace M_PIl with pi in libm-test.inc


This is useful in situations where the long double type is
less precise than the type under test.

	* libm-test.inc: Replace usage of M_PIl with
	[pi]: New macro.
---
 math/libm-test.inc | 78 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 40 insertions(+), 38 deletions(-)

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 8f0a2af..3dfe465 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -326,6 +326,8 @@ struct ulp_data
 #define pi_ln10_d		LIT (1.364376353841841347485783625431355770)
 /* pi / 2 */
 #define pi_2_d			LIT (1.570796326794896619231321691639751442)
+/* pi */
+#define pi			LIT (3.141592653589793238462643383279502884)
 
 #define ulps_file_name "ULPs"	/* Name of the ULPs file.  */
 static FILE *ulps_file;		/* File to document difference.  */
@@ -1980,18 +1982,18 @@ static const struct test_ff_f_data atan2_test_data[] =
     TEST_ff_f (atan2, minus_infty, -max_value, -pi_2_d, ERRNO_UNCHANGED),
 
     /* atan2 (y,-inf) == +pi for finite y > 0 or +0.  */
-    TEST_ff_f (atan2, 1, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, plus_zero, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, min_value, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, min_subnorm_value, minus_infty, M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, max_value, minus_infty, M_PIl, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, 1, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, plus_zero, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, min_value, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, min_subnorm_value, minus_infty, pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, max_value, minus_infty, pi, ERRNO_UNCHANGED),
 
     /* atan2 (y,-inf) == -pi for finite y < 0 or -0.  */
-    TEST_ff_f (atan2, -1, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, minus_zero, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, -min_value, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, -min_subnorm_value, minus_infty, -M_PIl, ERRNO_UNCHANGED),
-    TEST_ff_f (atan2, -max_value, minus_infty, -M_PIl, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -1, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, minus_zero, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -min_value, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -min_subnorm_value, minus_infty, -pi, ERRNO_UNCHANGED),
+    TEST_ff_f (atan2, -max_value, minus_infty, -pi, ERRNO_UNCHANGED),
 
     TEST_ff_f (atan2, plus_infty, plus_infty, M_PI_4l, ERRNO_UNCHANGED),
     TEST_ff_f (atan2, minus_infty, plus_infty, -M_PI_4l, ERRNO_UNCHANGED),
@@ -2101,10 +2103,10 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, 0.1L, plus_infty, pi_2_d, minus_infty),
     TEST_c_c (cacos, 0.1L, minus_infty, pi_2_d, plus_infty),
 
-    TEST_c_c (cacos, minus_infty, 0, M_PIl, minus_infty),
-    TEST_c_c (cacos, minus_infty, minus_zero, M_PIl, plus_infty),
-    TEST_c_c (cacos, minus_infty, 100, M_PIl, minus_infty),
-    TEST_c_c (cacos, minus_infty, -100, M_PIl, plus_infty),
+    TEST_c_c (cacos, minus_infty, 0, pi, minus_infty),
+    TEST_c_c (cacos, minus_infty, minus_zero, pi, plus_infty),
+    TEST_c_c (cacos, minus_infty, 100, pi, minus_infty),
+    TEST_c_c (cacos, minus_infty, -100, pi, plus_infty),
 
     TEST_c_c (cacos, plus_infty, 0, 0.0, minus_infty),
     TEST_c_c (cacos, plus_infty, minus_zero, 0.0, plus_infty),
@@ -2141,10 +2143,10 @@ static const struct test_c_c_data cacos_test_data[] =
     TEST_c_c (cacos, plus_zero, 1.5L, pi_2_d, -1.194763217287109304111930828519090523536L),
     TEST_c_c (cacos, minus_zero, 1.5L, pi_2_d, -1.194763217287109304111930828519090523536L),
 
-    TEST_c_c (cacos, -1.5L, plus_zero, M_PIl, -0.9624236501192068949955178268487368462704L),
-    TEST_c_c (cacos, -1.5L, minus_zero, M_PIl, 0.9624236501192068949955178268487368462704L),
-    TEST_c_c (cacos, -1.0L, plus_zero, M_PIl, minus_zero),
-    TEST_c_c (cacos, -1.0L, minus_zero, M_PIl, plus_zero),
+    TEST_c_c (cacos, -1.5L, plus_zero, pi, -0.9624236501192068949955178268487368462704L),
+    TEST_c_c (cacos, -1.5L, minus_zero, pi, 0.9624236501192068949955178268487368462704L),
+    TEST_c_c (cacos, -1.0L, plus_zero, pi, minus_zero),
+    TEST_c_c (cacos, -1.0L, minus_zero, pi, plus_zero),
     TEST_c_c (cacos, -0.5L, plus_zero, 2.094395102393195492308428922186335256131L, minus_zero),
     TEST_c_c (cacos, -0.5L, minus_zero, 2.094395102393195492308428922186335256131L, plus_zero),
     TEST_c_c (cacos, 0.5L, plus_zero, 1.047197551196597746154214461093167628066L, minus_zero),
@@ -2788,10 +2790,10 @@ static const struct test_c_c_data cacosh_test_data[] =
     TEST_c_c (cacosh, 0.1L, plus_infty, plus_infty, pi_2_d),
     TEST_c_c (cacosh, 0.1L, minus_infty, plus_infty, -pi_2_d),
 
-    TEST_c_c (cacosh, minus_infty, 0, plus_infty, M_PIl),
-    TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -M_PIl),
-    TEST_c_c (cacosh, minus_infty, 100, plus_infty, M_PIl),
-    TEST_c_c (cacosh, minus_infty, -100, plus_infty, -M_PIl),
+    TEST_c_c (cacosh, minus_infty, 0, plus_infty, pi),
+    TEST_c_c (cacosh, minus_infty, minus_zero, plus_infty, -pi),
+    TEST_c_c (cacosh, minus_infty, 100, plus_infty, pi),
+    TEST_c_c (cacosh, minus_infty, -100, plus_infty, -pi),
 
     TEST_c_c (cacosh, plus_infty, 0, plus_infty, 0.0),
     TEST_c_c (cacosh, plus_infty, minus_zero, plus_infty, minus_zero),
@@ -2828,10 +2830,10 @@ static const struct test_c_c_data cacosh_test_data[] =
     TEST_c_c (cacosh, plus_zero, 1.5L, 1.194763217287109304111930828519090523536L, pi_2_d),
     TEST_c_c (cacosh, minus_zero, 1.5L, 1.194763217287109304111930828519090523536L, pi_2_d),
 
-    TEST_c_c (cacosh, -1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, M_PIl),
-    TEST_c_c (cacosh, -1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, -M_PIl),
-    TEST_c_c (cacosh, -1.0L, plus_zero, plus_zero, M_PIl),
-    TEST_c_c (cacosh, -1.0L, minus_zero, plus_zero, -M_PIl),
+    TEST_c_c (cacosh, -1.5L, plus_zero, 0.9624236501192068949955178268487368462704L, pi),
+    TEST_c_c (cacosh, -1.5L, minus_zero, 0.9624236501192068949955178268487368462704L, -pi),
+    TEST_c_c (cacosh, -1.0L, plus_zero, plus_zero, pi),
+    TEST_c_c (cacosh, -1.0L, minus_zero, plus_zero, -pi),
     TEST_c_c (cacosh, -0.5L, plus_zero, plus_zero, 2.094395102393195492308428922186335256131L),
     TEST_c_c (cacosh, -0.5L, minus_zero, plus_zero, -2.094395102393195492308428922186335256131L),
     TEST_c_c (cacosh, 0.5L, plus_zero, plus_zero, 1.047197551196597746154214461093167628066L),
@@ -3469,10 +3471,10 @@ static const struct test_c_f_data carg_test_data[] =
     TEST_c_f (carg, 10.0, minus_infty, -pi_2_d),
 
     /* carg (-inf + i y) == +pi for finite y > 0.  */
-    TEST_c_f (carg, minus_infty, 10.0, M_PIl),
+    TEST_c_f (carg, minus_infty, 10.0, pi),
 
     /* carg (-inf + i y) == -pi for finite y < 0.  */
-    TEST_c_f (carg, minus_infty, -10.0, -M_PIl),
+    TEST_c_f (carg, minus_infty, -10.0, -pi),
 
     TEST_c_f (carg, plus_infty, plus_infty, M_PI_4l),
 
@@ -6025,8 +6027,8 @@ static const struct test_f_f_data ceil_test_data[] =
     TEST_f_f (ceil, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
     /* Bug 15479: spurious "inexact" exception may occur.  */
-    TEST_f_f (ceil, M_PIl, 4.0, ERRNO_UNCHANGED),
-    TEST_f_f (ceil, -M_PIl, -3.0, ERRNO_UNCHANGED),
+    TEST_f_f (ceil, pi, 4.0, ERRNO_UNCHANGED),
+    TEST_f_f (ceil, -pi, -3.0, ERRNO_UNCHANGED),
     TEST_f_f (ceil, min_subnorm_value, 1.0, ERRNO_UNCHANGED),
     TEST_f_f (ceil, min_value, 1.0, ERRNO_UNCHANGED),
     TEST_f_f (ceil, 0.1, 1.0, ERRNO_UNCHANGED),
@@ -6234,8 +6236,8 @@ cimag_test (void)
 
 static const struct test_c_c_data clog_test_data[] =
   {
-    TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION),
-    TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -M_PIl, DIVIDE_BY_ZERO_EXCEPTION),
+    TEST_c_c (clog, minus_zero, 0, minus_infty, pi, DIVIDE_BY_ZERO_EXCEPTION),
+    TEST_c_c (clog, minus_zero, minus_zero, minus_infty, -pi, DIVIDE_BY_ZERO_EXCEPTION),
 
     TEST_c_c (clog, 0, 0, minus_infty, 0.0, DIVIDE_BY_ZERO_EXCEPTION),
     TEST_c_c (clog, 0, minus_zero, minus_infty, minus_zero, DIVIDE_BY_ZERO_EXCEPTION),
@@ -6255,10 +6257,10 @@ static const struct test_c_c_data clog_test_data[] =
     TEST_c_c (clog, minus_zero, minus_infty, plus_infty, -pi_2_d),
     TEST_c_c (clog, -3, minus_infty, plus_infty, -pi_2_d),
 
-    TEST_c_c (clog, minus_infty, 0, plus_infty, M_PIl),
-    TEST_c_c (clog, minus_infty, 1, plus_infty, M_PIl),
-    TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -M_PIl),
-    TEST_c_c (clog, minus_infty, -1, plus_infty, -M_PIl),
+    TEST_c_c (clog, minus_infty, 0, plus_infty, pi),
+    TEST_c_c (clog, minus_infty, 1, plus_infty, pi),
+    TEST_c_c (clog, minus_infty, minus_zero, plus_infty, -pi),
+    TEST_c_c (clog, minus_infty, -1, plus_infty, -pi),
 
     TEST_c_c (clog, plus_infty, 0, plus_infty, 0.0),
     TEST_c_c (clog, plus_infty, 1, plus_infty, 0.0),
@@ -7168,8 +7170,8 @@ static const struct test_f_f_data floor_test_data[] =
     TEST_f_f (floor, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
 
     /* Bug 15479: spurious "inexact" exception may occur.  */
-    TEST_f_f (floor, M_PIl, 3.0, ERRNO_UNCHANGED),
-    TEST_f_f (floor, -M_PIl, -4.0, ERRNO_UNCHANGED),
+    TEST_f_f (floor, pi, 3.0, ERRNO_UNCHANGED),
+    TEST_f_f (floor, -pi, -4.0, ERRNO_UNCHANGED),
     TEST_f_f (floor, min_subnorm_value, 0.0, ERRNO_UNCHANGED),
     TEST_f_f (floor, min_value, 0.0, ERRNO_UNCHANGED),
     TEST_f_f (floor, 0.1, 0.0, ERRNO_UNCHANGED),
-- 
2.4.11


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