about summary refs log tree commit diff
path: root/math/gen-auto-libm-tests.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-19 21:28:30 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-19 21:28:30 +0000
commit64a17f1adde4715bb6607f64decd73b2df9e6852 (patch)
treee9c0b079df97abdf1f3d6cbad0ada43421ce8373 /math/gen-auto-libm-tests.c
parenteb983568758d85506a348ff63836a114584458b1 (diff)
downloadglibc-64a17f1adde4715bb6607f64decd73b2df9e6852.tar.gz
glibc-64a17f1adde4715bb6607f64decd73b2df9e6852.tar.xz
glibc-64a17f1adde4715bb6607f64decd73b2df9e6852.zip
Move tests of cabs and carg from libm-test.inc to auto-libm-test-in.
This patch moves tests of cabs and carg to auto-libm-test-in, adding
the required support to gen-auto-libm-tests.

Tested x86_64 and x86; no ulps updates needed.

	* math/auto-libm-test-in: Add tests of cabs and carg.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (cabs_test_data): Use AUTO_TESTS_c_f.
	(carg_test_data): Likewise.
	* math/gen-auto-libm-tests.c (func_calc_method): Add value
	mpc_c_f.
	(func_calc_desc): Add mpc_c_f union field.
	(test_functions): Add cabs and carg.
	(calc_generic_results): Handle mpc_c_f.
Diffstat (limited to 'math/gen-auto-libm-tests.c')
-rw-r--r--math/gen-auto-libm-tests.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index 9c8394e967..0201b8ae8b 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -403,6 +403,9 @@ typedef enum
     /* MPFR function with a single argument and two floating-point
        results.  */
     mpfr_f_11,
+    /* MPC function with a single complex argument and one real
+       result.  */
+    mpc_c_f,
   } func_calc_method;
 
 /* Description of how to calculate a function.  */
@@ -418,6 +421,7 @@ typedef struct
     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);
+    int (*mpc_c_f) (mpfr_t, const mpc_t, mpfr_rnd_t);
   } func;
 } func_calc_desc;
 
@@ -471,6 +475,9 @@ typedef struct
 #define FUNC_mpfr_if_f(NAME, MPFR_FUNC, EXACT)				\
   FUNC (NAME, ARGS2 (type_int, type_fp), RET1 (type_fp), EXACT, false,	\
 	CALC (mpfr_if_f, MPFR_FUNC))
+#define FUNC_mpc_c_f(NAME, MPFR_FUNC, EXACT)				\
+  FUNC (NAME, ARGS2 (type_fp, type_fp), RET1 (type_fp), EXACT, true,	\
+	CALC (mpc_c_f, MPFR_FUNC))
 
 /* List of functions handled by this program.  */
 static test_function test_functions[] =
@@ -482,6 +489,8 @@ static test_function test_functions[] =
     FUNC_mpfr_f_f ("atan", mpfr_atan, false),
     FUNC_mpfr_ff_f ("atan2", mpfr_atan2, false),
     FUNC_mpfr_f_f ("atanh", mpfr_atanh, false),
+    FUNC_mpc_c_f ("cabs", mpc_abs, false),
+    FUNC_mpc_c_f ("carg", mpc_arg, false),
     FUNC_mpfr_f_f ("cbrt", mpfr_cbrt, false),
     FUNC_mpfr_f_f ("cos", mpfr_cos, false),
     FUNC_mpfr_f_f ("cosh", mpfr_cosh, false),
@@ -1379,6 +1388,20 @@ calc_generic_results (generic_value *outputs, generic_value *inputs,
       adjust_real (outputs[1].value.f, (comb_ternary & 0xc) != 0);
       break;
 
+    case mpc_c_f:
+      assert (inputs[0].type == gtype_fp);
+      assert (inputs[1].type == gtype_fp);
+      outputs[0].type = gtype_fp;
+      mpfr_init (outputs[0].value.f);
+      mpc_t ci;
+      mpc_init2 (ci, internal_precision);
+      assert_exact (mpc_set_fr_fr (ci, inputs[0].value.f, inputs[1].value.f,
+				   MPC_RNDNN));
+      inexact = calc->func.mpc_c_f (outputs[0].value.f, ci, MPFR_RNDZ);
+      adjust_real (outputs[0].value.f, inexact);
+      mpc_clear (ci);
+      break;
+
     default:
       abort ();
     }