about summary refs log tree commit diff
path: root/math/libm-test.inc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-11-29 16:27:55 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-11-29 16:27:55 +0000
commitffb536d0ac914a110c160c48d01097d132e20531 (patch)
treeaaf8d810651e89fa739d42791d66ce1c6df0885e /math/libm-test.inc
parent97161a937370c6a20f93647b3260a7d1a87f2645 (diff)
downloadglibc-ffb536d0ac914a110c160c48d01097d132e20531.tar.gz
glibc-ffb536d0ac914a110c160c48d01097d132e20531.tar.xz
glibc-ffb536d0ac914a110c160c48d01097d132e20531.zip
Start generating libm tests automatically with MPFR.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r--math/libm-test.inc63
1 files changed, 49 insertions, 14 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 0c88abc3db..017fa63122 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -175,12 +175,13 @@ struct ulp_data
 #define IGNORE_ZERO_INF_SIGN		0x400
 #define TEST_NAN_SIGN			0x800
 #define NO_TEST_INLINE			0x1000
+#define XFAIL_TEST			0x2000
 /* Indicate errno settings required or disallowed.  */
-#define ERRNO_UNCHANGED			0x2000
-#define ERRNO_EDOM			0x4000
-#define ERRNO_ERANGE			0x8000
+#define ERRNO_UNCHANGED			0x4000
+#define ERRNO_EDOM			0x8000
+#define ERRNO_ERANGE			0x10000
 /* Flags generated by gen-libm-test.pl, not entered here manually.  */
-#define IGNORE_RESULT			0x10000
+#define IGNORE_RESULT			0x20000
 
 /* Values underflowing only for float.  */
 #ifdef TEST_FLOAT
@@ -225,6 +226,47 @@ struct ulp_data
 # define NO_TEST_INLINE_DOUBLE	0
 #endif
 
+/* Conditions used by tests generated by gen-auto-libm-tests.c.  */
+#ifdef TEST_FLOAT
+# define TEST_COND_flt_32	1
+#else
+# define TEST_COND_flt_32	0
+#endif
+#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MANT_DIG == 53)
+# define TEST_COND_dbl_64	1
+#else
+# define TEST_COND_dbl_64	0
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64 && LDBL_MIN_EXP == -16381
+# define TEST_COND_ldbl_96_intel	1
+#else
+# define TEST_COND_ldbl_96_intel	0
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64 && LDBL_MIN_EXP == -16382
+# define TEST_COND_ldbl_96_m68k	1
+#else
+# define TEST_COND_ldbl_96_m68k	0
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 113
+# define TEST_COND_ldbl_128	1
+#else
+# define TEST_COND_ldbl_128	0
+#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
+# define TEST_COND_ldbl_128ibm	1
+#else
+# define TEST_COND_ldbl_128ibm	0
+#endif
+#if LONG_MAX == 0x7fffffff
+# define TEST_COND_long32	1
+# define TEST_COND_long64	0
+#else
+# define TEST_COND_long32	0
+# define TEST_COND_long64	1
+#endif
+#define TEST_COND_before_rounding	(!TININESS_AFTER_ROUNDING)
+#define TEST_COND_after_rounding	TININESS_AFTER_ROUNDING
+
 /* Various constants (we must supply them precalculated for accuracy).  */
 #define M_PI_6l			.52359877559829887307710723054658383L
 #define M_E2l			7.389056098930650227230427460575008L
@@ -997,6 +1039,8 @@ check_longlong (const char *test_name, long long int computed,
 static int
 enable_test (int exceptions)
 {
+  if (exceptions & XFAIL_TEST)
+    return 0;
 #ifdef TEST_INLINE
   if (exceptions & NO_TEST_INLINE)
     return 0;
@@ -13707,24 +13751,15 @@ sinh_test_upward (void)
 
 static const struct test_f_f_data sqrt_test_data[] =
   {
-    TEST_f_f (sqrt, 0, 0, NO_INEXACT_EXCEPTION),
     TEST_f_f (sqrt, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
     TEST_f_f (sqrt, plus_infty, plus_infty, NO_INEXACT_EXCEPTION),
 
-    TEST_f_f (sqrt, minus_zero, minus_zero, NO_INEXACT_EXCEPTION),
-
     /* sqrt (x) == qNaN plus invalid exception for x < 0.  */
     TEST_f_f (sqrt, -1, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION|ERRNO_EDOM),
     TEST_f_f (sqrt, -max_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION|ERRNO_EDOM),
     TEST_f_f (sqrt, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION|ERRNO_EDOM),
 
-    TEST_f_f (sqrt, 2209, 47, NO_INEXACT_EXCEPTION),
-    TEST_f_f (sqrt, 4, 2, NO_INEXACT_EXCEPTION),
-    TEST_f_f (sqrt, 2, M_SQRT2l, INEXACT_EXCEPTION),
-    TEST_f_f (sqrt, 0.25, 0.5, NO_INEXACT_EXCEPTION),
-    TEST_f_f (sqrt, 6642.25, 81.5, NO_INEXACT_EXCEPTION),
-    TEST_f_f (sqrt, 15190.5625L, 123.25L, NO_INEXACT_EXCEPTION),
-    TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L, INEXACT_EXCEPTION),
+    AUTO_TESTS_f_f (sqrt, tonearest),
   };
 
 static void