diff options
Diffstat (limited to 'math/test/rtest/dotest.c')
-rw-r--r-- | math/test/rtest/dotest.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/math/test/rtest/dotest.c b/math/test/rtest/dotest.c index 5b3e9b4f18e4..dd8ceb068141 100644 --- a/math/test/rtest/dotest.c +++ b/math/test/rtest/dotest.c @@ -1,7 +1,7 @@ /* * dotest.c - actually generate mathlib test cases * - * Copyright (c) 1999-2019, Arm Limited. + * Copyright (c) 1999-2024, Arm Limited. * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ @@ -18,6 +18,35 @@ #define MPFR_PREC 96 /* good enough for float or double + a few extra bits */ +#if MPFR_VERSION < MPFR_VERSION_NUM(4, 2, 0) +int +mpfr_tanpi (mpfr_t ret, const mpfr_t arg, mpfr_rnd_t rnd) +{ + MPFR_DECL_INIT (frd, MPFR_PREC); + mpfr_const_pi (frd, GMP_RNDN); + mpfr_mul (frd, frd, arg, GMP_RNDN); + return mpfr_tan (ret, frd, GMP_RNDN); +} + +int +mpfr_sinpi (mpfr_t ret, const mpfr_t arg, mpfr_rnd_t rnd) +{ + MPFR_DECL_INIT (frd, MPFR_PREC); + mpfr_const_pi (frd, GMP_RNDN); + mpfr_mul (frd, frd, arg, GMP_RNDN); + return mpfr_sin (ret, frd, GMP_RNDN); +} + +int +mpfr_cospi (mpfr_t ret, const mpfr_t arg, mpfr_rnd_t rnd) +{ + MPFR_DECL_INIT (frd, MPFR_PREC); + mpfr_const_pi (frd, GMP_RNDN); + mpfr_mul (frd, frd, arg, GMP_RNDN); + return mpfr_cos (ret, frd, GMP_RNDN); +} +#endif + extern int lib_fo, lib_no_arith, ntests; /* @@ -454,6 +483,7 @@ void universal_wrapper(wrapperctx *ctx) } } +/* clang-format off */ Testable functions[] = { /* * Trig functions: sin, cos, tan. We test the core function @@ -479,6 +509,18 @@ Testable functions[] = { cases_uniform_float, 0x39800000, 0x41800000}, {"sincosf_cosf", (funcptr)mpfr_cos, args1f, {NULL}, cases_uniform_float, 0x39800000, 0x41800000}, + {"sinpi", (funcptr)mpfr_sinpi, args1, {NULL}, + cases_uniform, 0x3e400000, 0x40300000}, + {"sinpif", (funcptr)mpfr_sinpi, args1f, {NULL}, + cases_uniform_float, 0x39800000, 0x41800000}, + {"cospi", (funcptr)mpfr_cospi, args1, {NULL}, + cases_uniform, 0x3e400000, 0x40300000}, + {"cospif", (funcptr)mpfr_cospi, args1f, {NULL}, + cases_uniform_float, 0x39800000, 0x41800000}, + {"tanpi", (funcptr)mpfr_tanpi, args1, {NULL}, + cases_uniform, 0x3e400000, 0x40300000}, + {"tanpif", (funcptr)mpfr_tanpi, args1f, {NULL}, + cases_uniform_float, 0x39800000, 0x41800000}, /* * Inverse trig: asin, acos. Between 1 and -1, of course. acos * goes down to 2^-54, asin to 2^-27. @@ -708,6 +750,7 @@ Testable functions[] = { {"tgammaf", (funcptr)mpfr_gamma, args1f, {NULL}, cases_uniform_float, 0x2f800000, 0x43000000}, {"tgamma", (funcptr)mpfr_gamma, args1, {NULL}, cases_uniform, 0x3c000000, 0x40800000}, }; +/* clang-format on */ const int nfunctions = ( sizeof(functions)/sizeof(*functions) ); |