This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Use decimal constants in defining M_* in libm-test.inc
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 8 May 2013 19:38:23 +0000
- Subject: Use decimal constants in defining M_* in libm-test.inc
For IBM long double, GCC does not constant-fold expressions that are
not exact in 106 bits, resulting in errors for valid static
initializers <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26374>.
Thus, to convert libm tests to being based on static data, such
expressions need to be avoided in test arguments and expected results.
Various values used in some tests are defined in libm-test.inc as
expressions that may not be exact. This patch changes those M_*
macros in libm-test.inc to use decimal values (with 36 places after
the point, as in math.h) to avoid such problems.
Tested x86_64 and x86. No ulps updates needed, but it's possible some
platforms might need ulps updates if this patch results in a more
accurate value of an expected result being used.
2013-05-08 Joseph Myers <joseph@codesourcery.com>
* math/libm-test.inc (M_PI_34l): Define using decimal constant.
(M_PI_34_LOG10El): Likewise.
(M_PI2_LOG10El): Likewise.
(M_PI4_LOG10El): Likewise.
(M_PI_LOG10El): Likewise.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 6294f72..9b47ab3 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -207,11 +207,11 @@
#define M_SQRT_PIl 1.7724538509055160272981674833411451L /* sqrt (M_PIl) */
#define M_LOG_SQRT_PIl 0.57236494292470008707171367567652933L /* log(sqrt(M_PIl)) */
#define M_LOG_2_SQRT_PIl 1.265512123484645396488945797134706L /* log(2*sqrt(M_PIl)) */
-#define M_PI_34l (M_PIl - M_PI_4l) /* 3*pi/4 */
-#define M_PI_34_LOG10El (M_PIl - M_PI_4l) * M_LOG10El
-#define M_PI2_LOG10El M_PI_2l * M_LOG10El
-#define M_PI4_LOG10El M_PI_4l * M_LOG10El
-#define M_PI_LOG10El M_PIl * M_LOG10El
+#define M_PI_34l 2.356194490192344928846982537459627163L /* 3*pi/4 */
+#define M_PI_34_LOG10El 1.023282265381381010614337719073516828L
+#define M_PI2_LOG10El 0.682188176920920673742891812715677885L
+#define M_PI4_LOG10El 0.341094088460460336871445906357838943L
+#define M_PI_LOG10El 1.364376353841841347485783625431355770L
#define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
#define ulps_file_name "ULPs" /* Name of the ULPs file. */
--
Joseph S. Myers
joseph@codesourcery.com