summaryrefslogtreecommitdiff
path: root/tests/tset.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-02-05 17:59:48 +0000
committerthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-02-05 17:59:48 +0000
commit9c305dd081f8e646d5ad37037992e8b5e1569eef (patch)
treec090e84a4b3b098e5cf7074444cf11bdd56d04ee /tests/tset.c
parentee8653ab57c3703821e35ef1d4e10b25d17fa278 (diff)
downloadmpc-9c305dd081f8e646d5ad37037992e8b5e1569eef.tar.gz
src/mpc.h: add new mpc_set_x functions (change macros mpc_set_d, mpc_set_ui, mpc_set_si into functions).
src/set_fr.c: renamed set_x.c src/set_x.c: add set_x for x = d, ld, ui, si, z, q, f. src/Makefile.am: Add set_x.c, remove set_fr.c tests/tset.c: Add test for new set_x functions. doc/mpc.texi: Add new set_x functions NEWS: Add new set_x functions. git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@413 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tset.c')
-rw-r--r--tests/tset.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/tset.c b/tests/tset.c
index e2eb7e8..dcafc2c 100644
--- a/tests/tset.c
+++ b/tests/tset.c
@@ -1,4 +1,4 @@
-/* tset.c -- Test file for mpc_set_x functions.
+/* tset.c -- Test file for mpc_set_x and mpc_set_x_x functions.
Copyright (C) 2009 Philippe Th\'eveny
@@ -100,6 +100,13 @@ main (void)
|| mpfr_cmp_ui (MPC_IM(z), prec) != 0)
PRINT_ERROR ("mpc_set_ui_ui", prec, z);
+ mpc_set_ld (z, 1.23456789L, MPC_RNDNN);
+ mpfr_clear_flags ();
+ if (mpfr_cmp (MPC_RE(z), fr) != 0
+ || mpfr_cmp_ui (MPC_IM(z), 0) != 0
+ || mpfr_erangeflag_p())
+ PRINT_ERROR ("mpc_set_ld", prec, z);
+
mpc_set_prec (x, prec);
mpfr_set_ui(fr, 1, GMP_RNDN);
mpfr_div_ui(fr, fr, 3, GMP_RNDN);
@@ -145,6 +152,13 @@ main (void)
|| mpfr_erangeflag_p())
PRINT_ERROR ("mpc_set_fr_fr", prec, z);
+ mpc_set_z (z, mpz, MPC_RNDNN);
+ mpfr_clear_flags ();
+ if (mpfr_cmp (MPC_RE(z), fr) != 0
+ || mpfr_cmp_ui (MPC_IM(z), 0) != 0
+ || mpfr_erangeflag_p())
+ PRINT_ERROR ("mpc_set_z", prec, z);
+
mpfr_set_q (fr, mpq, GMP_RNDN);
mpc_set_q_q (z, mpq, mpq, MPC_RNDNN);
mpfr_clear_flags ();
@@ -160,6 +174,13 @@ main (void)
|| mpfr_erangeflag_p())
PRINT_ERROR ("mpc_set_fr_fr", prec, z);
+ mpc_set_q (z, mpq, MPC_RNDNN);
+ mpfr_clear_flags ();
+ if (mpfr_cmp (MPC_RE(z), fr) != 0
+ || mpfr_cmp_ui (MPC_IM(z), 0) != 0
+ || mpfr_erangeflag_p())
+ PRINT_ERROR ("mpc_set_q", prec, z);
+
mpfr_set_f (fr, mpf, GMP_RNDN);
mpc_set_f_f (z, mpf, mpf, MPC_RNDNN);
mpfr_clear_flags ();
@@ -168,6 +189,13 @@ main (void)
|| mpfr_erangeflag_p())
PRINT_ERROR ("mpc_set_f_f", prec, z);
+ mpc_set_f (z, mpf, MPC_RNDNN);
+ mpfr_clear_flags ();
+ if (mpfr_cmp (MPC_RE(z), fr) != 0
+ || mpfr_cmp_ui (MPC_IM(z), 0) != 0
+ || mpfr_erangeflag_p())
+ PRINT_ERROR ("mpc_set_f", prec, z);
+
#ifdef _MPC_H_HAVE_INTMAX_T
{
uintmax_t uim = prec;