summaryrefslogtreecommitdiff
path: root/src/fma.c
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-06-28 11:46:36 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-06-28 11:46:36 +0000
commitd52b9345e935e26971639dcda8970694140f7298 (patch)
tree8b5679fa4b51eec0e0ebd9523c8c94dc99cd4de4 /src/fma.c
parentdccc01961014c5dfdb18a4556a8f2b65e1932263 (diff)
downloadmpc-d52b9345e935e26971639dcda8970694140f7298.tar.gz
log: alternative implementation that avoids intermediate overflows
It is probably slower (two calls to log) and should be combined with the previous approach. Problem of "underflow" (log of number close to 1) not yet solved. git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1202 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/fma.c')
-rw-r--r--src/fma.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fma.c b/src/fma.c
index d4be40f..726ec4e 100644
--- a/src/fma.c
+++ b/src/fma.c
@@ -154,6 +154,20 @@ mpc_fma (mpc_ptr r, mpc_srcptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
mpc_init3 (ab, wpre, wpim);
for (i = 0; i < 2; ++i)
{
+#define MPC_OUT(x) \
+do { \
+ printf (#x "[%lu,%lu]=", (unsigned long int) MPC_PREC_RE (x), \
+ (unsigned long int) MPC_PREC_IM (x)); \
+ mpc_out_str (stdout, 2, 0, x, MPC_RNDNN); \
+ printf ("\n"); \
+} while (0)
+
+#define MPFR_OUT(x) \
+do { \
+ printf (#x "[%lu]=", (unsigned long int) mpfr_get_prec (x)); \
+ mpfr_out_str (stdout, 2, 0, x, GMP_RNDN); \
+ printf ("\n"); \
+} while (0)
mpc_mul (ab, a, b, MPC_RNDZZ);
if (mpfr_zero_p (mpc_realref(ab)) || mpfr_zero_p (mpc_imagref(ab)))
break;