diff options
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/asinh.dsc | 28 | ||||
-rw-r--r-- | tests/atan.dsc | 28 | ||||
-rw-r--r-- | tests/atanh.dsc | 28 | ||||
-rw-r--r-- | tests/tasinh_tmpl.c | 65 | ||||
-rw-r--r-- | tests/tatan_tmpl.c | 75 | ||||
-rw-r--r-- | tests/tatanh_tmpl.c | 65 |
7 files changed, 294 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 9f86598..28c82ac 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,8 +29,8 @@ LOADLIBES=$(DEFS) -I$(top_srcdir)/src -I$(top_builddir) $(CPPFLAGS) \ $(CFLAGS) -L$(top_builddir)/tests/.libs -lmpc-tests -lmpc -lm $(LIBS) TEMPLATED = tabs_tmpl tacos_tmpl tacosh_tmpl tadd_tmpl tadd_fr_tmpl \ - tasin_tmpl tmul_tmpl tpow_tmpl tpow_fr_tmpl tpow_si_tmpl tpow_ui_tmpl \ - tpow_z_tmpl tsub_tmpl + tasin_tmpl tasinh_tmpl tatan_tmpl tatanh_tmpl tmul_tmpl tpow_tmpl \ + tpow_fr_tmpl tpow_si_tmpl tpow_ui_tmpl tpow_z_tmpl tsub_tmpl check_PROGRAMS = tabs tacos tacosh tadd tadd_fr tadd_si tadd_ui targ tasin \ tasinh tatan tatanh tconj tcos tcosh tdiv tdiv_2si tdiv_2ui tdiv_fr tdiv_ui \ texp tfma tfr_div tfr_sub timag tio_str tlog tlog10 tmul tmul_2si tmul_2ui \ @@ -46,9 +46,9 @@ libmpc_tests_la_SOURCES=mpc-tests.h random.c tgeneric.c read_data.c \ print_parameter.c read_description.c read_line.c tpl_gmp.c \ tpl_mpc.c tpl_mpfr.c tpl_native.c -TEMPLATES = data_check.tpl abs.dsc acos.dsc acosh.dsc asin.dsc add.dsc \ - add_fr.dsc add_si.dsc add_ui.dsc mul.dsc pow.dsc pow_fr.dsc pow_si.dsc \ - pow_ui.dsc pow_z.dsc sub.dsc +TEMPLATES = data_check.tpl abs.dsc acos.dsc acosh.dsc asin.dsc asinh.dsc \ + atan.dsc atanh.dsc add.dsc add_fr.dsc add_si.dsc add_ui.dsc mul.dsc pow.dsc \ + pow_fr.dsc pow_si.dsc pow_ui.dsc pow_z.dsc sub.dsc DATA_SETS = abs.dat acos.dat acosh.dat asin.dat asinh.dat atan.dat \ atanh.dat add.dat add_fr.dat arg.dat conj.dat cos.dat cosh.dat \ div.dat div_fr.dat exp.dat fma.dat fr_div.dat fr_sub.dat \ diff --git a/tests/asinh.dsc b/tests/asinh.dsc new file mode 100644 index 0000000..5a7097b --- /dev/null +++ b/tests/asinh.dsc @@ -0,0 +1,28 @@ +# Description file for mpc_asinh +# +# Copyright (C) 2013 INRIA +# +# This file is part of GNU MPC. +# +# GNU MPC is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +#o ption) any later version. +# +# GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see http://www.gnu.org/licenses/ . +# +NAME: + mpc_asinh +RETURN: + mpc_inex +OUTPUT: + mpc_ptr +INPUT: + mpc_srcptr + mpc_rnd_t diff --git a/tests/atan.dsc b/tests/atan.dsc new file mode 100644 index 0000000..686190b --- /dev/null +++ b/tests/atan.dsc @@ -0,0 +1,28 @@ +# Description file for mpc_atan +# +# Copyright (C) 2013 INRIA +# +# This file is part of GNU MPC. +# +# GNU MPC is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +#o ption) any later version. +# +# GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see http://www.gnu.org/licenses/ . +# +NAME: + mpc_atan +RETURN: + mpc_inex +OUTPUT: + mpc_ptr +INPUT: + mpc_srcptr + mpc_rnd_t diff --git a/tests/atanh.dsc b/tests/atanh.dsc new file mode 100644 index 0000000..d02736a --- /dev/null +++ b/tests/atanh.dsc @@ -0,0 +1,28 @@ +# Description file for mpc_atanh +# +# Copyright (C) 2013 INRIA +# +# This file is part of GNU MPC. +# +# GNU MPC is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +#o ption) any later version. +# +# GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +# more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see http://www.gnu.org/licenses/ . +# +NAME: + mpc_atanh +RETURN: + mpc_inex +OUTPUT: + mpc_ptr +INPUT: + mpc_srcptr + mpc_rnd_t diff --git a/tests/tasinh_tmpl.c b/tests/tasinh_tmpl.c new file mode 100644 index 0000000..5664020 --- /dev/null +++ b/tests/tasinh_tmpl.c @@ -0,0 +1,65 @@ +/* tasinh_tmpl -- templated test file for mpc_asinh. + +Copyright (C) 2009, 2013 INRIA + +This file is part of GNU MPC. + +GNU MPC is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see http://www.gnu.org/licenses/ . +*/ + +#include "templates.h" +#include "mpc-tests.h" + +static void +bug20091120 (void) +{ + mpc_t x, y; + + mpc_init2 (x, 53); + mpc_init3 (y, 17, 42); + mpc_set_ui_ui (x, 1, 1, MPC_RNDNN); + mpc_asinh (y, x, MPC_RNDNN); + if (mpfr_get_prec (mpc_realref(y)) != 17 || + mpfr_get_prec (mpc_imagref(y)) != 42) + { + printf ("Error, mpc_asinh changed the precisions!!!\n"); + exit (1); + } + mpc_clear (x); + mpc_clear (y); +} + +#define MPC_FUNCTION_CALL \ + P[0].mpc_inex = mpc_asinh (P[1].mpc, P[2].mpc, P[3].mpc_rnd) +#define MPC_FUNCTION_CALL_REUSE_OP1 \ + P[0].mpc_inex = mpc_asinh (P[1].mpc, P[1].mpc, P[3].mpc_rnd) + +#include "data_check.tpl" + +int +main (void) +{ + DECL_FUNC (CC, f, mpc_asinh); + + test_start (); + + bug20091120 (); + + data_check_template ("asinh.dsc", "asinh.dat"); + tgeneric (f, 2, 512, 7, 7); + + test_end (); + + return 0; +} diff --git a/tests/tatan_tmpl.c b/tests/tatan_tmpl.c new file mode 100644 index 0000000..6c68840 --- /dev/null +++ b/tests/tatan_tmpl.c @@ -0,0 +1,75 @@ +/* tatan_tmpl -- templated test file for mpc_atan. + +Copyright (C) 2009, 2012, 2013 INRIA + +This file is part of GNU MPC. + +GNU MPC is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see http://www.gnu.org/licenses/ . +*/ + +#include "templates.h" +#include "mpc-tests.h" + +#if 0 +/* tests intermediate underflow; WONTFIX */ +static int +test_underflow (void) +{ + mpc_t z; + mpfr_exp_t emin = mpfr_get_emin (); + + mpfr_set_emin (-10); + mpc_init2 (z, 21); + mpfr_set_si (mpc_realref(z), -1, MPFR_RNDZ); + mpfr_set_ui_2exp (mpc_imagref(z), 1, 20, MPFR_RNDZ); + mpfr_add_ui (mpc_imagref(z), mpc_imagref(z), 1, MPFR_RNDZ); + mpfr_div_2exp (mpc_imagref(z), mpc_imagref(z), 20, MPFR_RNDZ); + mpc_atan (z, z, MPC_RNDNN); + if (mpfr_cmp_si_2exp (mpc_realref(z), -1066635, 20) != 0 || + mpfr_cmp_si_2exp (mpc_imagref(z), 1687619, 22)) + { + printf ("Error in test_coverage\n"); + printf ("expected (-1066635/2^20 1687619/2^22)\n"); + printf ("got "); + mpc_out_str (stdout, 10, 20, z, MPC_RNDNN); + printf ("\n"); + exit (1); + } + mpc_clear (z); + mpfr_set_emin (emin); +} +#endif + +#define MPC_FUNCTION_CALL \ + P[0].mpc_inex = mpc_atan (P[1].mpc, P[2].mpc, P[3].mpc_rnd) +#define MPC_FUNCTION_CALL_REUSE_OP1 \ + P[0].mpc_inex = mpc_atan (P[1].mpc, P[1].mpc, P[3].mpc_rnd) + +#include "data_check.tpl" + +int +main (void) +{ + DECL_FUNC (CC, f, mpc_atan); + + test_start (); + + data_check_template ("atan.dsc", "atan.dat"); + tgeneric (f, 2, 512, 5, 128); + + test_end (); + + return 0; +} + diff --git a/tests/tatanh_tmpl.c b/tests/tatanh_tmpl.c new file mode 100644 index 0000000..77ad689 --- /dev/null +++ b/tests/tatanh_tmpl.c @@ -0,0 +1,65 @@ +/* tatanh_tmpl -- templated test file for mpc_atanh. + +Copyright (C) 2009, 2013 INRIA + +This file is part of GNU MPC. + +GNU MPC is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see http://www.gnu.org/licenses/ . +*/ + +#include "templates.h" +#include "mpc-tests.h" + +static void +bug20091120 (void) +{ + mpc_t x, y; + + mpc_init2 (x, 53); + mpc_init3 (y, 17, 42); + mpc_set_ui_ui (x, 1, 1, MPC_RNDNN); + mpc_atanh (y, x, MPC_RNDNN); + if (mpfr_get_prec (mpc_realref(y)) != 17 || + mpfr_get_prec (mpc_imagref(y)) != 42) + { + printf ("Error, mpc_atanh changed the precisions!!!\n"); + exit (1); + } + mpc_clear (x); + mpc_clear (y); +} + +#define MPC_FUNCTION_CALL \ + P[0].mpc_inex = mpc_atanh (P[1].mpc, P[2].mpc, P[3].mpc_rnd) +#define MPC_FUNCTION_CALL_REUSE_OP1 \ + P[0].mpc_inex = mpc_atanh (P[1].mpc, P[1].mpc, P[3].mpc_rnd) + +#include "data_check.tpl" + +int +main (void) +{ + DECL_FUNC (CC, f, mpc_atanh); + + test_start (); + + bug20091120 (); + + data_check_template ("atanh.dsc", "atanh.dat"); + tgeneric (f, 2, 512, 5, 128); + + test_end (); + + return 0; +} |