diff options
author | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-09-24 10:14:20 +0000 |
---|---|---|
committer | thevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-09-24 10:14:20 +0000 |
commit | 638b0e723a5f7891b69bdde938fe625a18e52f22 (patch) | |
tree | b88e3071adb41426387ca1550e6223061a5aad29 /tests/tfr_sub.c | |
parent | cf0287be2d1f292ba808ea1de011195ac8dd5a24 (diff) | |
download | mpc-638b0e723a5f7891b69bdde938fe625a18e52f22.tar.gz |
src/fr_sub.c: Fix bug revealed by tests (wrong sign in imaginary part).
tests/tgeneric_cfc.c: random tests for complex functions of two variables : the first one of type mpfr_t and the second one of type mpc_t; and tests for parameter reuse.
tests/Makefile.am: add tgeneric_cfc.c to EXTRA_DIST and add new tests files.
tests/tfr_div.c tests/tfr_sub.c: use tgeneric_cfc.c
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@196 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tfr_sub.c')
-rw-r--r-- | tests/tfr_sub.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/tfr_sub.c b/tests/tfr_sub.c new file mode 100644 index 0000000..adb6aa6 --- /dev/null +++ b/tests/tfr_sub.c @@ -0,0 +1,59 @@ +/* tfr_div -- test file for mpc_fr_sub. + +Copyright (C) 2008 Philippe Th\'eveny + +This file is part of the MPC Library. + +The MPC 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 MPC 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 MPC Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +MA 02111-1307, USA. */ + +#include <stdio.h> +#include <stdlib.h> +#include "gmp.h" +#include "mpfr.h" +#include "mpc.h" + +static int +mpc_fr_sub_ref (mpc_t q, mpfr_t x, mpc_t z, mpc_rnd_t rnd); + +#include "random.c" +#define TEST_FUNCTION mpc_fr_sub +#define REFERENCE_FUNCTION mpc_fr_sub_ref +#include "tgeneric_cfc.c" + +static int +mpc_fr_sub_ref (mpc_t q, mpfr_t x, mpc_t z, mpc_rnd_t rnd) +{ + int inexact; + mpc_t y; + mpc_init2 (y, MPFR_PREC (x)); + mpc_set_fr (y, x, MPC_RNDNN); + + inexact = mpc_sub (q, y, z, rnd); + + mpc_clear (y); + return inexact; +} + +int +main (void) +{ + test_start(); + + tgeneric (2, 4096, 7, 0); + + test_end (); + return 0; +} |