summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-06-27 14:56:17 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-06-27 14:56:17 +0000
commit9d58fe511a520e8f698cb8d07a62aad257eb067a (patch)
treee821d56c4f5ea19080ece9e7e0a7a7632e16fdec
parentb17945e0ad92be088e36bad22fe41438776b6f35 (diff)
downloadmpc-9d58fe511a520e8f698cb8d07a62aad257eb067a.tar.gz
merge trunk into branch rootsunity
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/branches/rootsunity@1196 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r--doc/mpc.texi19
-rw-r--r--src/fma.c2
-rw-r--r--src/pow_ui.c6
-rw-r--r--tests/fma.dat3
-rw-r--r--tests/log.dat3
-rw-r--r--tests/pow_ui.dat3
6 files changed, 22 insertions, 14 deletions
diff --git a/doc/mpc.texi b/doc/mpc.texi
index a724877..e38fedf 100644
--- a/doc/mpc.texi
+++ b/doc/mpc.texi
@@ -858,6 +858,11 @@ Set @var{rop} to @var{op1} @minus{} @var{op2} rounded according to @var{rnd}.
For @code{mpc_ui_ui_sub}, @var{op1} is @var{re1} + @var{im1}.
@end deftypefn
+@deftypefun int mpc_neg (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd})
+Set @var{rop} to @minus{}@var{op} rounded according to @var{rnd}.
+Just changes the sign if @var{rop} and @var{op} are the same variable.
+@end deftypefun
+
@deftypefun int mpc_mul (mpc_t @var{rop}, mpc_t @var{op1}, mpc_t @var{op2}, mpc_rnd_t @var{rnd})
@deftypefunx int mpc_mul_ui (mpc_t @var{rop}, mpc_t @var{op1}, unsigned long int @var{op2}, mpc_rnd_t @var{rnd})
@deftypefunx int mpc_mul_si (mpc_t @var{rop}, mpc_t @var{op1}, long int @var{op2}, mpc_rnd_t @var{rnd})
@@ -877,6 +882,11 @@ in both cases rounded according to @var{rnd}.
Set @var{rop} to the square of @var{op} rounded according to @var{rnd}.
@end deftypefun
+@deftypefun int mpc_fma (mpc_t @var{rop}, mpc_t @var{op1}, mpc_t @var{op2}, mpc_t @var{op3}, mpc_rnd_t @var{rnd})
+Set @var{rop} to @var{op1}*@var{op2}+@var{op3},
+rounded according to @var{rnd}, with only one final rounding.
+@end deftypefun
+
@deftypefun int mpc_div (mpc_t @var{rop}, mpc_t @var{op1}, mpc_t @var{op2}, mpc_rnd_t @var{rnd})
@deftypefunx int mpc_div_ui (mpc_t @var{rop}, mpc_t @var{op1}, unsigned long int @var{op2}, mpc_rnd_t @var{rnd})
@deftypefunx int mpc_div_fr (mpc_t @var{rop}, mpc_t @var{op1}, mpfr_t @var{op2}, mpc_rnd_t @var{rnd})
@@ -885,11 +895,6 @@ Set @var{rop} to the square of @var{op} rounded according to @var{rnd}.
Set @var{rop} to @var{op1}/@var{op2} rounded according to @var{rnd}.
@end deftypefun
-@deftypefun int mpc_neg (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd})
-Set @var{rop} to @minus{}@var{op} rounded according to @var{rnd}.
-Just changes the sign if @var{rop} and @var{op} are the same variable.
-@end deftypefun
-
@deftypefun int mpc_conj (mpc_t @var{rop}, mpc_t @var{op}, mpc_rnd_t @var{rnd})
Set @var{rop} to the conjugate of @var{op} rounded according to @var{rnd}.
Just changes the sign of the imaginary part
@@ -921,10 +926,6 @@ of the real and imaginary parts by @var{op2}
when @var{rop} and @var{op1} are identical.
@end deftypefun
-@deftypefun int mpc_fma (mpc_t @var{rop}, mpc_t @var{op1}, mpc_t @var{op2}, mpc_t @var{op3}, mpc_rnd_t @var{rnd})
-Set @var{rop} to @var{op1} @times @var{op2} plus @var{op3},
-rounded according to @var{rnd}, with only one final rounding.
-@end deftypefun
@node Power Functions and Logarithm
@section Power Functions and Logarithm
diff --git a/src/fma.c b/src/fma.c
index fa2c0ca..d4be40f 100644
--- a/src/fma.c
+++ b/src/fma.c
@@ -142,7 +142,7 @@ mpc_fma (mpc_ptr r, mpc_srcptr a, mpc_srcptr b, mpc_srcptr c, mpc_rnd_t rnd)
mpc_t ab;
mpfr_prec_t pre, pim, wpre, wpim;
mpfr_exp_t diffre, diffim;
- int i, inex, okre = 0, okim = 0;
+ int i, inex = 0, okre = 0, okim = 0;
if (mpc_fin_p (a) == 0 || mpc_fin_p (b) == 0 || mpc_fin_p (c) == 0)
return mpc_fma_naive (r, a, b, c, rnd);
diff --git a/src/pow_ui.c b/src/pow_ui.c
index 3381028..da82a94 100644
--- a/src/pow_ui.c
+++ b/src/pow_ui.c
@@ -1,6 +1,6 @@
/* mpc_pow_ui -- Raise a complex number to an integer power.
-Copyright (C) 2009, 2010, 2011 INRIA
+Copyright (C) 2009, 2010, 2011, 2012 INRIA
This file is part of GNU MPC.
@@ -131,9 +131,9 @@ mpc_pow_usi (mpc_ptr z, mpc_srcptr x, unsigned long y, int sign,
/* the factor on the imaginary part is 2+2^(diff+2) <= 4 for diff <= -1
and < 2^(diff+3) for diff >= 0 */
ei = (diff <= -1) ? l0 + 3 : l0 + diff + 3;
- if (mpfr_can_round (mpc_realref(t), p - er, GMP_RNDZ, GMP_RNDZ,
+ if (mpfr_can_round (mpc_realref(t), p - er, GMP_RNDN, GMP_RNDZ,
MPC_PREC_RE(z) + (MPC_RND_RE(rnd) == GMP_RNDN))
- && mpfr_can_round (mpc_imagref(t), p - ei, GMP_RNDZ, GMP_RNDZ,
+ && mpfr_can_round (mpc_imagref(t), p - ei, GMP_RNDN, GMP_RNDZ,
MPC_PREC_IM(z) + (MPC_RND_IM(rnd) == GMP_RNDN))) {
inex = mpc_set (z, t, rnd);
done = 1;
diff --git a/tests/fma.dat b/tests/fma.dat
index 3389591..6d0f682 100644
--- a/tests/fma.dat
+++ b/tests/fma.dat
@@ -1,6 +1,6 @@
# Data file for mpc_exp.
#
-# Copyright (C) 2008, 2010 INRIA
+# Copyright (C) 2008, 2010, 2012 INRIA
#
# This file is part of GNU MPC.
#
@@ -29,3 +29,4 @@
+ + 53 -0x178a1d3cd134e5p-49 53 -0x189281b52abc03p-55 53 -0x9CC470A049097p-50 53 0x16A09E667F3BCDp-52 53 0x23C6EF372FE95p-48 53 0x9CC470A049097p-50 53 -0x16A09E667F3BCDp-51 53 0xA953FD4E97C75p-50 U U
0 0 10 0 10 0 10 7 10 5 10 3 10 -12 10 -81 10 69 N N
0 0 10 0 10 0 10 7 10 5 10 3 10 -12 10 -81 10 69 Z D
+0 0 2 1 2 1 7 99 7 98 7 97 7 96 7 -194 15 -19009 N N
diff --git a/tests/log.dat b/tests/log.dat
index 1ca4ec1..57e3b35 100644
--- a/tests/log.dat
+++ b/tests/log.dat
@@ -170,3 +170,6 @@
# instead of the correct result. Since this may happen in other parts of the
# library as well, we do not consider it a bug for the moment.
# + + 53 0x58B90BFD4BCBFp-22 2 0x1p0 2 0x1p536870912 2 0x1p536870912 U U
+
+# log(-1 + i*eps) : infinite loop ?
+# 0 0 2 0 2 0b11 2 -1 2 0x1p-1073741813 N N
diff --git a/tests/pow_ui.dat b/tests/pow_ui.dat
index 2a82700..d448a68 100644
--- a/tests/pow_ui.dat
+++ b/tests/pow_ui.dat
@@ -97,3 +97,6 @@
# special cases with exponents 1 and 2
0 0 53 3 53 4 53 3 53 4 1 N N
0 0 53 -7 53 24 53 3 53 4 2 N N
+
+# coverage test
++ - 2 1 2 1 100 0x8ac78f4e6aec091921cbdc891p-99 100 0x4a5f2972ea662e1cc0caebb81p-100 3 N N