diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-12-20 12:32:44 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-12-20 12:32:44 +0000 |
commit | 7fda568229f73137f54a8d5da071f5e73ea50627 (patch) | |
tree | 4861c648df08ef3156da3001dd70b52130e9759d /math/gen-auto-libm-tests.c | |
parent | 392dd2de03c054b1b32358561570be14f55e9ae9 (diff) | |
download | glibc-7fda568229f73137f54a8d5da071f5e73ea50627.zip glibc-7fda568229f73137f54a8d5da071f5e73ea50627.tar.gz glibc-7fda568229f73137f54a8d5da071f5e73ea50627.tar.bz2 |
Move various TEST_c_c tests from libm-test.inc to auto-libm-test-inc.
This patch moves tests of ccos, ccosh, cexp, clog, csqrt, ctan and
ctanh to auto-libm-test-in, adding the required support to
gen-auto-libm-tests. Other TEST_c_c functions aren't moved for now
(although the relevant table entries are put in gen-auto-libm-tests
for it to know how to handle them): clog10 because of a known MPC bug
causing it to hang for at least some pure imaginary inputs (fixed in
SVN, but I'd rather not rely on unreleased versions of MPFR or MPC
even if relying on very recent releases); the inverse trig and
hyperbolic functions because of known slowness in special cases; and
csin / csinh because of observed slowness that I need to investigate
and report to the MPC maintainers. Slowness can be bypassed by moving
to incremental generation (only for new / changed tests) rather than
regenerating the whole of auto-libm-test-out every time, but that
needs implementing. (This patch takes the time for running
gen-auto-libm-tests from about one second to seven, on my system,
which I think is reasonable. The slow functions would make it take
several minutes at least, which seems unreasonable.)
Tested x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add tests of ccos, ccosh, cexp, clog,
csqrt, ctan and ctanh.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (TEST_COND_x86_64): New macro.
(TEST_COND_x86): Likewise.
(ccos_test_data): Use AUTO_TESTS_c_c.
(ccosh_test_data): Likewise.
(cexp_test_data): Likewise.
(clog_test_data): Likewise.
(csqrt_test_data): Likewise.
(ctan_test_data): Likewise.
(ctan_tonearest_test_data): Likewise.
(ctan_towardzero_test_data): Likewise.
(ctan_downward_test_data): Likewise.
(ctan_upward_test_data): Likewise.
(ctanh_test_data): Likewise.
(ctanh_tonearest_test_data): Likewise.
(ctanh_towardzero_test_data): Likewise.
(ctanh_downward_test_data): Likewise.
(ctanh_upward_test_data): Likewise.
* math/gen-auto-libm-tests.c (func_calc_method): Add value
mpc_c_c.
(func_calc_desc): Add mpc_c_c union field.
(FUNC_mpc_c_c): New macro.
(test_functions): Add cacos, cacosh, casin, casinh, catan, catanh,
ccos, ccosh, cexp, clog, clog10, csin, csinh, csqrt, ctan and
ctanh.
(special_fill_min_subnorm_p120): New function.
(special_real_inputs): Add min_subnorm_p120.
(calc_generic_results): Handle mpc_c_c.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Diffstat (limited to 'math/gen-auto-libm-tests.c')
-rw-r--r-- | math/gen-auto-libm-tests.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c index 0201b8a..c96615f 100644 --- a/math/gen-auto-libm-tests.c +++ b/math/gen-auto-libm-tests.c @@ -406,6 +406,9 @@ typedef enum /* MPC function with a single complex argument and one real result. */ mpc_c_f, + /* MPC function with a single complex argument and one complex + result. */ + mpc_c_c, } func_calc_method; /* Description of how to calculate a function. */ @@ -422,6 +425,7 @@ typedef struct 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); + int (*mpc_c_c) (mpc_t, const mpc_t, mpc_rnd_t); } func; } func_calc_desc; @@ -478,6 +482,9 @@ typedef struct #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)) +#define FUNC_mpc_c_c(NAME, MPFR_FUNC, EXACT) \ + FUNC (NAME, ARGS2 (type_fp, type_fp), RET2 (type_fp, type_fp), EXACT, \ + true, CALC (mpc_c_c, MPFR_FUNC)) /* List of functions handled by this program. */ static test_function test_functions[] = @@ -490,10 +497,26 @@ static test_function test_functions[] = 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_c ("cacos", mpc_acos, false), + FUNC_mpc_c_c ("cacosh", mpc_acosh, false), FUNC_mpc_c_f ("carg", mpc_arg, false), + FUNC_mpc_c_c ("casin", mpc_asin, false), + FUNC_mpc_c_c ("casinh", mpc_asinh, false), + FUNC_mpc_c_c ("catan", mpc_atan, false), + FUNC_mpc_c_c ("catanh", mpc_atanh, false), FUNC_mpfr_f_f ("cbrt", mpfr_cbrt, false), + FUNC_mpc_c_c ("ccos", mpc_cos, false), + FUNC_mpc_c_c ("ccosh", mpc_cosh, false), + FUNC_mpc_c_c ("cexp", mpc_exp, false), + FUNC_mpc_c_c ("clog", mpc_log, false), + FUNC_mpc_c_c ("clog10", mpc_log10, false), FUNC_mpfr_f_f ("cos", mpfr_cos, false), FUNC_mpfr_f_f ("cosh", mpfr_cosh, false), + FUNC_mpc_c_c ("csin", mpc_sin, false), + FUNC_mpc_c_c ("csinh", mpc_sinh, false), + FUNC_mpc_c_c ("csqrt", mpc_sqrt, false), + FUNC_mpc_c_c ("ctan", mpc_tan, false), + FUNC_mpc_c_c ("ctanh", mpc_tanh, false), FUNC_mpfr_f_f ("erf", mpfr_erf, false), FUNC_mpfr_f_f ("erfc", mpfr_erfc, false), FUNC_mpfr_f_f ("exp", mpfr_exp, false), @@ -735,6 +758,17 @@ special_fill_minus_min_subnorm (mpfr_t res0, } static size_t +special_fill_min_subnorm_p120 (mpfr_t res0, + mpfr_t res1 __attribute__ ((unused)), + fp_format format) +{ + mpfr_init2 (res0, fp_formats[format].mant_dig); + assert_exact (mpfr_mul_2ui (res0, fp_formats[format].subnorm_min, + 120, MPFR_RNDN)); + return 1; +} + +static size_t special_fill_pi (mpfr_t res0, mpfr_t res1, fp_format format) { mpfr_init2 (res0, fp_formats[format].mant_dig); @@ -899,6 +933,7 @@ static const special_real_input special_real_inputs[] = { "-min", special_fill_minus_min }, { "min_subnorm", special_fill_min_subnorm }, { "-min_subnorm", special_fill_minus_min_subnorm }, + { "min_subnorm_p120", special_fill_min_subnorm_p120 }, { "pi", special_fill_pi }, { "-pi", special_fill_minus_pi }, { "pi/2", special_fill_pi_2 }, @@ -1402,6 +1437,29 @@ calc_generic_results (generic_value *outputs, generic_value *inputs, mpc_clear (ci); break; + case mpc_c_c: + assert (inputs[0].type == gtype_fp); + assert (inputs[1].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); + mpc_t co; + mpc_init2 (ci, internal_precision); + mpc_init2 (co, internal_precision); + assert_exact (mpc_set_fr_fr (ci, inputs[0].value.f, inputs[1].value.f, + MPC_RNDNN)); + int mpc_ternary = calc->func.mpc_c_c (co, ci, MPC_RNDZZ); + assert_exact (mpfr_set (outputs[0].value.f, mpc_realref (co), + MPFR_RNDN)); + assert_exact (mpfr_set (outputs[1].value.f, mpc_imagref (co), + MPFR_RNDN)); + adjust_real (outputs[0].value.f, MPC_INEX_RE (mpc_ternary)); + adjust_real (outputs[1].value.f, MPC_INEX_IM (mpc_ternary)); + mpc_clear (ci); + mpc_clear (co); + break; + default: abort (); } |