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]

Move tests of sincos from libm-test.inc to auto-libm-test-in


This patch moves tests of sincos to auto-libm-test-in, adding the
required support to gen-auto-libm-tests.

Tested x86_64 and x86 and ulps updated accordingly.

(auto-libm-test-out diffs omitted below.)

2013-12-19  Joseph Myers  <joseph@codesourcery.com>

	* math/auto-libm-test-in: Add tests of sincos.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (sincos_test_data): Use AUTO_TESTS_fFF_11.
	* math/gen-auto-libm-tests.c (func_calc_method): Add value
	mpfr_f_11.
	(func_calc_desc): Add mpfr_f_11 union field.
	(test_functions): Add sincos.
	(calc_generic_results): Handle mpfr_f_11.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 28e9d45..49f6604 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -848,6 +848,25 @@ sin 8
 sin 9
 sin 10
 
+sincos 0
+sincos -0
+sincos pi/2
+sincos pi/6
+sincos pi/3
+sincos 0.75
+sincos 0x1p65
+sincos -0x1p65
+sincos 0.80190127184058835
+sincos 1e22
+sincos 0x1p1023
+sincos 0x1p16383
+sincos 0x1p+120
+sincos 0x1p+127
+sincos 0x1.fffff8p+127
+sincos 0x1.fffffep+127
+sincos 0x1p+50
+sincos 0x1p+28
+
 sinh 0
 sinh -0
 sinh 0.75
diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index 8a02b60..9c8394e 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -400,6 +400,9 @@ typedef enum
     /* MPFR function with integer and floating-point arguments and one
        result.  */
     mpfr_if_f,
+    /* MPFR function with a single argument and two floating-point
+       results.  */
+    mpfr_f_11,
   } func_calc_method;
 
 /* Description of how to calculate a function.  */
@@ -414,6 +417,7 @@ typedef struct
     int (*mpfr_ff_f) (mpfr_t, const mpfr_t, const mpfr_t, mpfr_rnd_t);
     int (*mpfr_f_f1) (mpfr_t, int *, const mpfr_t, mpfr_rnd_t);
     int (*mpfr_if_f) (mpfr_t, long, const mpfr_t, mpfr_rnd_t);
+    int (*mpfr_f_11) (mpfr_t, mpfr_t, const mpfr_t, mpfr_rnd_t);
   } func;
 } func_calc_desc;
 
@@ -499,6 +503,8 @@ static test_function test_functions[] =
     FUNC_mpfr_f_f ("log2", mpfr_log2, false),
     FUNC_mpfr_ff_f ("pow", mpfr_pow, false),
     FUNC_mpfr_f_f ("sin", mpfr_sin, false),
+    FUNC ("sincos", ARGS1 (type_fp), RET2 (type_fp, type_fp), false, false,
+	  CALC (mpfr_f_11, mpfr_sin_cos)),
     FUNC_mpfr_f_f ("sinh", mpfr_sinh, false),
     FUNC_mpfr_f_f ("sqrt", mpfr_sqrt, true),
     FUNC_mpfr_f_f ("tan", mpfr_tan, false),
@@ -1359,6 +1365,20 @@ calc_generic_results (generic_value *outputs, generic_value *inputs,
       adjust_real (outputs[0].value.f, inexact);
       break;
 
+    case mpfr_f_11:
+      assert (inputs[0].type == gtype_fp);
+      outputs[0].type = gtype_fp;
+      mpfr_init (outputs[0].value.f);
+      outputs[1].type = gtype_fp;
+      mpfr_init (outputs[1].value.f);
+      int comb_ternary = calc->func.mpfr_f_11 (outputs[0].value.f,
+					       outputs[1].value.f,
+					       inputs[0].value.f,
+					       MPFR_RNDZ);
+      adjust_real (outputs[0].value.f, (comb_ternary & 0x3) != 0);
+      adjust_real (outputs[1].value.f, (comb_ternary & 0xc) != 0);
+      break;
+
     default:
       abort ();
     }
diff --git a/math/libm-test.inc b/math/libm-test.inc
index aab3ed2..7ee4b82 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -12503,64 +12503,11 @@ sin_test_upward (void)
 
 static const struct test_fFF_11_data sincos_test_data[] =
   {
-    TEST_fFF_11 (sincos, 0, 0, 1),
-
-    TEST_fFF_11 (sincos, minus_zero, minus_zero, 1),
     TEST_fFF_11 (sincos, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
     TEST_fFF_11 (sincos, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
     TEST_fFF_11 (sincos, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
 
-    /* The value of M_PI_2l is never exactly PI/2, and therefore the
-       answer is never exactly zero. The answer is equal to the error
-       in rounding PI/2 for the type used.  Thus the answer is unique
-       to each type.  */
-#ifdef TEST_FLOAT
-    /* 32-bit float.  */
-    TEST_fFF_11 (sincos, M_PI_2l, 1, -0x1.777a5cp-25L),
-#endif
-#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MANT_DIG == 53)
-    /* 64-bit double or 64-bit long double.  */
-    TEST_fFF_11 (sincos, M_PI_2l, 1, 0x1.1a62633145c07p-54L),
-#endif
-#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 64
-    /* 96-bit long double.  */
-    TEST_fFF_11 (sincos, M_PI_2l, 1, -0xe.ce675d1fc8f8cbbp-69L),
-#endif
-#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
-    /* 128-bit IBM long double.  */
-    TEST_fFF_11 (sincos, M_PI_2l, 1, 0x1.c1cd129024e088a67cc74020bcp-107L),
-#endif
-#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 113
-    /* 128-bit long double.  */
-    TEST_fFF_11 (sincos, M_PI_2l, 1, 0x1.cd129024e088a67cc74020bbea64p-115L),
-#endif
-
-    TEST_fFF_11 (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L),
-    TEST_fFF_11 (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5),
-    TEST_fFF_11 (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L),
-
-    TEST_fFF_11 (sincos, 0x1p65, -0.047183876212354673805106149805700013943218L, 0.99888622066058013610642172179340364209972L),
-    TEST_fFF_11 (sincos, -0x1p65, 0.047183876212354673805106149805700013943218L, 0.99888622066058013610642172179340364209972L),
-
-#ifdef TEST_DOUBLE
-    TEST_fFF_11 (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473),
-#endif
-
-#ifndef TEST_FLOAT
-    TEST_fFF_11 (sincos, 1e22, -0.8522008497671888017727058937530293682618L, 0.5232147853951389454975944733847094921409L),
-    TEST_fFF_11 (sincos, 0x1p1023, 0.5631277798508840134529434079444683477104L, -0.826369834614147994500785680811743734805L),
-#endif
-
-#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
-    TEST_fFF_11 (sincos, 0x1p16383L, 0.3893629985894208126948115852610595405563L, 0.9210843909921906206874509522505756251609L),
-#endif
-
-    TEST_fFF_11 (sincos, 0x1p+120, 3.77820109360752022655548470056922991960587e-01L, -9.25879022854837867303861764107414946730833e-01L),
-    TEST_fFF_11 (sincos, 0x1p+127, 6.23385512955870240370428801097126489001833e-01L, 7.81914638714960072263910298466369236613162e-01L),
-    TEST_fFF_11 (sincos, 0x1.fffff8p+127, 4.85786063130487339701113680434728152037092e-02L, 9.98819362551949040703862043664101081064641e-01L),
-    TEST_fFF_11 (sincos, 0x1.fffffep+127, -5.21876523333658540551505357019806722935726e-01L, 8.53021039830304158051791467692161107353094e-01L),
-    TEST_fFF_11 (sincos, 0x1p+50, 4.96396515208940840876821859865411368093356e-01L, 8.68095904660550604334592502063501320395739e-01L),
-    TEST_fFF_11 (sincos, 0x1p+28, -9.86198211836975655703110310527108292055548e-01L, -1.65568979490578758865468278195361551113358e-01L),
+    AUTO_TESTS_fFF_11 (sincos, tonearest),
   };
 
 static void
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 6b154bc..ca16bc5 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -8084,6 +8084,12 @@ float: 1
 ifloat: 1
 
 # sincos
+Test "sincos (0x1.921fb4p+0) extra output 2":
+ildouble: 1
+ldouble: 1
+Test "sincos (0xf.ffffffffffff8p+1020) extra output 1":
+ildouble: 1
+ldouble: 1
 Test "sincos (M_PI_6l*2.0) extra output 1":
 double: 1
 float: 1
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index a4fa4a2..7e612b0 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -9120,6 +9120,12 @@ float: 1
 ifloat: 1
 
 # sincos
+Test "sincos (0x1.921fb4p+0) extra output 2":
+ildouble: 1
+ldouble: 1
+Test "sincos (0xf.ffffffffffff8p+1020) extra output 1":
+ildouble: 1
+ldouble: 1
 Test "sincos (M_PI_6l*2.0) extra output 1":
 double: 1
 float: 1

-- 
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]