aboutsummaryrefslogtreecommitdiff
path: root/math/gen-auto-libm-tests.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-18 17:59:29 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-18 17:59:29 +0000
commitf889953b44da50bf8a7824c97d09dbe03fd11b83 (patch)
treed498fd7f8015c4de4f9fe5bfaf3b6bd476271dd7 /math/gen-auto-libm-tests.c
parent237764876709dfbd81ae9fc9f91ef7e496a3eb08 (diff)
downloadglibc-f889953b44da50bf8a7824c97d09dbe03fd11b83.tar
glibc-f889953b44da50bf8a7824c97d09dbe03fd11b83.tar.gz
glibc-f889953b44da50bf8a7824c97d09dbe03fd11b83.tar.bz2
glibc-f889953b44da50bf8a7824c97d09dbe03fd11b83.zip
Move tests of jn and yn from libm-test.inc to auto-libm-test-in.
This patch moves tests of jn and yn to auto-libm-test-in, adding the required support for gen-auto-libm-tests (and adding a missing assertion there and fixing logic that was broken for functions with integer arguments). Tested x86_64 and x86 and ulps updated accordingly. * math/auto-libm-test-in: Add tests of jn and yn. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (jn_test_data): Use AUTO_TESTS_if_f. (yn_test_data): Likewise. * math/gen-auto-libm-tests.c (func_calc_method): Add value mpfr_if_f. (func_calc_desc): Add mpfr_if_f union field. (FUNC_mpfr_if_f): New macro. (test_functions): Add jn and yn. (calc_generic_results): Assert type of second input for mpfr_ff_f. Handle mpfr_if_f. (output_for_one_input_case): Disable all checking for arguments fitting floating-point types in case of an integer argument. * 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.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/math/gen-auto-libm-tests.c b/math/gen-auto-libm-tests.c
index d25363bf0e..8a02b60bbf 100644
--- a/math/gen-auto-libm-tests.c
+++ b/math/gen-auto-libm-tests.c
@@ -397,6 +397,9 @@ typedef enum
/* MPFR function with a single argument and floating-point and
integer results. */
mpfr_f_f1,
+ /* MPFR function with integer and floating-point arguments and one
+ result. */
+ mpfr_if_f,
} func_calc_method;
/* Description of how to calculate a function. */
@@ -410,6 +413,7 @@ typedef struct
int (*mpfr_f_f) (mpfr_t, const mpfr_t, mpfr_rnd_t);
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);
} func;
} func_calc_desc;
@@ -460,6 +464,9 @@ typedef struct
#define FUNC_mpfr_ff_f(NAME, MPFR_FUNC, EXACT) \
FUNC (NAME, ARGS2 (type_fp, type_fp), RET1 (type_fp), EXACT, false, \
CALC (mpfr_ff_f, MPFR_FUNC))
+#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))
/* List of functions handled by this program. */
static test_function test_functions[] =
@@ -483,6 +490,7 @@ static test_function test_functions[] =
FUNC_mpfr_ff_f ("hypot", mpfr_hypot, false),
FUNC_mpfr_f_f ("j0", mpfr_j0, false),
FUNC_mpfr_f_f ("j1", mpfr_j1, false),
+ FUNC_mpfr_if_f ("jn", mpfr_jn, false),
FUNC ("lgamma", ARGS1 (type_fp), RET2 (type_fp, type_int), false, false,
CALC (mpfr_f_f1, mpfr_lgamma)),
FUNC_mpfr_f_f ("log", mpfr_log, false),
@@ -498,6 +506,7 @@ static test_function test_functions[] =
FUNC_mpfr_f_f ("tgamma", mpfr_gamma, false),
FUNC_mpfr_f_f ("y0", mpfr_y0, false),
FUNC_mpfr_f_f ("y1", mpfr_y1, false),
+ FUNC_mpfr_if_f ("yn", mpfr_yn, false),
};
/* Allocate memory, with error checking. */
@@ -1318,6 +1327,7 @@ calc_generic_results (generic_value *outputs, generic_value *inputs,
case mpfr_ff_f:
assert (inputs[0].type == gtype_fp);
+ assert (inputs[1].type == gtype_fp);
outputs[0].type = gtype_fp;
mpfr_init (outputs[0].value.f);
inexact = calc->func.mpfr_ff_f (outputs[0].value.f, inputs[0].value.f,
@@ -1337,6 +1347,18 @@ calc_generic_results (generic_value *outputs, generic_value *inputs,
mpz_init_set_si (outputs[1].value.i, i);
break;
+ case mpfr_if_f:
+ assert (inputs[0].type == gtype_int);
+ assert (inputs[1].type == gtype_fp);
+ outputs[0].type = gtype_fp;
+ mpfr_init (outputs[0].value.f);
+ assert (mpz_fits_slong_p (inputs[0].value.i));
+ long l = mpz_get_si (inputs[0].value.i);
+ inexact = calc->func.mpfr_if_f (outputs[0].value.f, l,
+ inputs[1].value.f, MPFR_RNDZ);
+ adjust_real (outputs[0].value.f, inexact);
+ break;
+
default:
abort ();
}
@@ -1547,13 +1569,16 @@ output_for_one_input_case (FILE *fp, const char *filename, test_function *tf,
for (size_t i = 0; i < tf->num_args; i++)
{
if (inputs[i].type == gtype_fp)
- round_real (res, exc_before, exc_after, inputs[i].value.f, f);
- if (!mpfr_equal_p (res[rm_tonearest], inputs[i].value.f))
- fits = false;
- for (rounding_mode m = rm_first_mode; m < rm_num_modes; m++)
- mpfr_clear (res[m]);
- if (!fits)
- break;
+ {
+ round_real (res, exc_before, exc_after, inputs[i].value.f,
+ f);
+ if (!mpfr_equal_p (res[rm_tonearest], inputs[i].value.f))
+ fits = false;
+ for (rounding_mode m = rm_first_mode; m < rm_num_modes; m++)
+ mpfr_clear (res[m]);
+ if (!fits)
+ break;
+ }
}
if (!fits)
continue;