summaryrefslogtreecommitdiff
path: root/tests/tlog.c
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-04-11 18:34:45 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-04-11 18:34:45 +0000
commit38b2ca3e1117f4d8e609618365d63a602a923f40 (patch)
tree5c9a5fb70891c81a3dbd82541db3788230c20ed8 /tests/tlog.c
parent9c00ca95cc39d2cc45d9cd1a0002372377276b62 (diff)
downloadmpc-38b2ca3e1117f4d8e609618365d63a602a923f40.tar.gz
avoided spurious error message for tlog in the following case:
Possible error in log; difference between z and z2=exp(log(z)): z=0+I*0.10E-1 tmp=-0.10110001E1+I*0.11001001E1 z2=0.10E-12+I*0.10E-1 git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@107 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tlog.c')
-rw-r--r--tests/tlog.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/tlog.c b/tests/tlog.c
index 9e75423..baebd1e 100644
--- a/tests/tlog.c
+++ b/tests/tlog.c
@@ -51,7 +51,10 @@ main()
mpc_set_prec (z2, prec);
mpc_set_prec (tmp, 4*prec);
- mpc_random (z);
+ /* The case of a purely imaginary number is treated below. */
+ do {
+ mpc_random (z);
+ } while (mpfr_zero_p (MPC_RE (z)));
mpc_log (tmp, z, MPC_RNDNN);
mpc_exp (z2, tmp, MPC_RNDNN);
@@ -84,7 +87,7 @@ main()
if ( mpfr_cmp (MPC_IM (z), MPC_IM (z2)) != 0
|| MPFR_EXP (MPC_RE (z)) > -4 * (mp_exp_t) prec)
{
- printf ("Possible error in log; difference between z and z2=log(exp(z)):\n");
+ printf ("Possible error in purely imaginary log; difference between z and z2=log(exp(z)):\n");
OUT (z);
OUT (tmp);
OUT (z2);