diff options
Diffstat (limited to 'math/gen-auto-libm-tests.c')
-rw-r--r-- | math/gen-auto-libm-tests.c | 23 |
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 (); } |