summaryrefslogtreecommitdiff
path: root/tests/tset.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-03-05 19:44:27 +0000
committerthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-03-05 19:44:27 +0000
commitfd1bcc36815b2838d4f5c57593e2a951baed675b (patch)
tree70f780b9f6d042e89f0b80d516f57f0c2f6d44b9 /tests/tset.c
parent18112d36fba8c97a80a69e65803508adf874cee7 (diff)
downloadmpc-fd1bcc36815b2838d4f5c57593e2a951baed675b.tar.gz
src/get_str.c: Fix bug when exponent is 0 or 1
tests/tset.c: Add non regression test for this bug git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@439 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tset.c')
-rw-r--r--tests/tset.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/tset.c b/tests/tset.c
index 9e44b71..922e913 100644
--- a/tests/tset.c
+++ b/tests/tset.c
@@ -277,6 +277,24 @@ check_set_str (mp_exp_t exp_max)
mpc_free_str (str);
}
+ /* the real part has a zero exponent in base ten (fixed in r439) */
+ mpc_set_prec (expected, 37);
+ mpc_set_prec (got, 37);
+ mpc_set_ui (expected, 0x921FC04ED, GMP_RNDN);
+ mpc_div_2exp (expected, expected, 37, MPC_RNDNN);
+ str = mpc_get_str (10, 0, expected, MPC_RNDNN);
+ if (mpc_set_str (got, str, 10, MPC_RNDNN) == -1
+ || mpc_cmp (got, expected) != 0)
+ {
+ printf ("Error: mpc_set_str o mpc_get_str != Id\n"
+ "with str=\"%s\"\n", str);
+ OUT (expected);
+ printf (" ");
+ OUT (got);
+ exit (1);
+ }
+ mpc_free_str (str);
+
mpc_clear (expected);
mpc_clear (got);
}