diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/reuse.c | 1 | ||||
-rw-r--r-- | tests/tli2.c | 96 |
3 files changed, 98 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 11951ed39..644f2b140 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = 1.6 gnu $(top_builddir)/ansi2knr -check_PROGRAMS = tversion tinternals tinits tisqrt tsgn tcheck tisnan texceptions tset_exp tset tabs tset_d tset_f tset_q tset_si tset_str tset_z tset_ld tset_sj tswap tcopysign tcmp tcmp2 tcmpabs tcmp_d tcmp_ld tcomparisons teq tadd tsub tmul tdiv tsub1sp tadd1sp tadd_ui tsub_ui tcmp_ui tdiv_ui tmul_ui tsqrt_ui tui_div tui_sub tadd_d tsub_d td_sub tmul_d tdiv_d td_div tgmpop tsi_op tmul_2exp tfma tfms tsum tdim tminmax tnext tfits tget_d tget_d_2exp tget_z tget_str tget_sj tout_str tinp_str toutimpl tcan_round tround_prec tsqrt tconst_log2 tconst_pi tconst_euler trandom ttrunc trint tfrac tmodf texp texp2 texp10 texpm1 tlog tlog2 tlog10 tlog1p tpow tui_pow tpow3 tcosh tsinh ttanh tsinh_cosh tacosh tasinh tatanh thyperbolic tasin tacos tcos tatan tsin ttan tsin_cos tagm thypot tfactorial tgamma terf tcbrt tzeta mpf_compat mpfr_compat reuse tsqr tstrtofr tpow_z tget_f tconst_catalan troot tsec tcsc tcot teint tcoth tcsch tsech tstckintc tsubnormal tlngamma tlgamma tzeta_ui tget_ld_2exp tget_set_d64 tj0 tj1 tjn ty0 ty1 tyn tremquo tfmod tl2b +check_PROGRAMS = tversion tinternals tinits tisqrt tsgn tcheck tisnan texceptions tset_exp tset tabs tset_d tset_f tset_q tset_si tset_str tset_z tset_ld tset_sj tswap tcopysign tcmp tcmp2 tcmpabs tcmp_d tcmp_ld tcomparisons teq tadd tsub tmul tdiv tsub1sp tadd1sp tadd_ui tsub_ui tcmp_ui tdiv_ui tmul_ui tsqrt_ui tui_div tui_sub tadd_d tsub_d td_sub tmul_d tdiv_d td_div tgmpop tsi_op tmul_2exp tfma tfms tsum tdim tminmax tnext tfits tget_d tget_d_2exp tget_z tget_str tget_sj tout_str tinp_str toutimpl tcan_round tround_prec tsqrt tconst_log2 tconst_pi tconst_euler trandom ttrunc trint tfrac tmodf texp texp2 texp10 texpm1 tlog tlog2 tlog10 tlog1p tpow tui_pow tpow3 tcosh tsinh ttanh tsinh_cosh tacosh tasinh tatanh thyperbolic tasin tacos tcos tatan tsin ttan tsin_cos tagm thypot tfactorial tgamma terf tcbrt tzeta mpf_compat mpfr_compat reuse tsqr tstrtofr tpow_z tget_f tconst_catalan troot tsec tcsc tcot teint tcoth tcsch tsech tstckintc tsubnormal tlngamma tlgamma tzeta_ui tget_ld_2exp tget_set_d64 tj0 tj1 tjn ty0 ty1 tyn tremquo tfmod tl2b tli2 EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.data diff --git a/tests/reuse.c b/tests/reuse.c index b2fb240e2..10b28b438 100644 --- a/tests/reuse.c +++ b/tests/reuse.c @@ -591,6 +591,7 @@ main (void) test2 (mpfr_erfc, "mpfr_erfc", p, rnd); test2 (mpfr_j0, "mpfr_j0", p, rnd); test2 (mpfr_j1, "mpfr_j1", p, rnd); + test2 (mpfr_li2, "mpfr_li2", p, rnd); test2 (mpfr_zeta, "mpfr_zeta", p, rnd); test2 (mpfr_gamma, "mpfr_gamma", p, rnd); diff --git a/tests/tli2.c b/tests/tli2.c new file mode 100644 index 000000000..2951fc740 --- /dev/null +++ b/tests/tli2.c @@ -0,0 +1,96 @@ +/* mpfr_tli2 -- test file for dilogarithm function + +Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +Contributed by the Arenaire and Cacao projects, INRIA. + +This file is part of the MPFR Library, and was contributed by Mathieu Dutour. + +The MPFR Library 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 2.1 of the License, or (at your +option) any later version. + +The MPFR Library 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 the MPFR Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +MA 02110-1301, USA. */ + +#include <stdio.h> +#include <stdlib.h> + +#include "mpfr-test.h" + +#define TEST_FUNCTION mpfr_li2 +#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1) +#include "tgeneric.c" + +static void +special (void) +{ + mpfr_t x, y; + mpfr_init (x); + mpfr_init (y); + + mpfr_set_nan (x); + mpfr_li2 (y, x, GMP_RNDN); + if (!mpfr_nan_p (y)) + { + printf ("Error for li2(NaN)\n"); + exit (1); + } + + mpfr_set_inf (x, -1); + mpfr_li2 (y, x, GMP_RNDN); + if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) + { + printf ("Error for li2(-Inf)\n"); + exit (1); + } + + mpfr_set_inf (x, 1); + mpfr_li2 (y, x, GMP_RNDN); + if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0) + { + printf ("Error for li2(+Inf)\n"); + exit (1); + } + + mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_li2 (y, x, GMP_RNDN); + if (!mpfr_zero_p (y) || mpfr_sgn (y) < 0) + { + printf ("Error for li2(+0)\n"); + exit (1); + } + + mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_neg (x, x, GMP_RNDN); + mpfr_li2 (y, x, GMP_RNDN); + if (!mpfr_zero_p (y) || mpfr_sgn (y) > 0) + { + printf ("Error for li2(-0)\n"); + exit (1); + } + + mpfr_clear (x); + mpfr_clear (y); +} + +int +main (int argc, char *argv[]) +{ + MPFR_TEST_USE_RANDS (); + tests_start_mpfr (); + + special (); + + test_generic (2, 100, 2); + + tests_end_mpfr (); + return 0; +} |