diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2012-06-25 15:50:58 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2012-06-25 15:50:58 +0000 |
commit | b03221371ac8a8906efef56991861b79b0fb0eef (patch) | |
tree | f37d4c1b89f4162f6453d4182067e18803d5a4f3 | |
parent | 03dd33b6234ee020f7cf9640285507674935ee5c (diff) | |
download | mpc-b03221371ac8a8906efef56991861b79b0fb0eef.tar.gz |
conj.dat, fr_sub.dat: complete branch test coverage
fr_sub.c: correct return value
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1161 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/fr_sub.c | 7 | ||||
-rw-r--r-- | tests/conj.dat | 7 | ||||
-rw-r--r-- | tests/fr_sub.dat | 7 |
4 files changed, 16 insertions, 6 deletions
@@ -12,6 +12,7 @@ Changes in version 1.0: or underflows during the computation - asin, proj, sqr: Wrong result when input variable has infinite part and equals output variable is corrected. + - fr_sub: Wrong return value for imaginary part. Changes in version 0.9: - New functions: diff --git a/src/fr_sub.c b/src/fr_sub.c index b39336c..91338a4 100644 --- a/src/fr_sub.c +++ b/src/fr_sub.c @@ -1,6 +1,6 @@ /* mpc_fr_sub -- Substract a complex number from a floating-point number. -Copyright (C) 2008, 2009, 2011 INRIA +Copyright (C) 2008, 2009, 2011, 2012 INRIA This file is part of GNU MPC. @@ -26,9 +26,8 @@ mpc_fr_sub (mpc_ptr a, mpfr_srcptr b, mpc_srcptr c, mpc_rnd_t rnd) { int inex_re, inex_im; - inex_re = mpfr_sub (mpc_realref(a), b, mpc_realref(c), MPC_RND_RE(rnd)); - inex_im = mpfr_set (mpc_imagref (a), mpc_imagref (c), INV_RND (MPC_RND_IM (rnd))); - MPFR_CHANGE_SIGN (mpc_imagref (a)); + inex_re = mpfr_sub (mpc_realref (a), b, mpc_realref (c), MPC_RND_RE (rnd)); + inex_im = mpfr_neg (mpc_imagref (a), mpc_imagref (c), MPC_RND_IM (rnd)); return MPC_INEX(inex_re, inex_im); } diff --git a/tests/conj.dat b/tests/conj.dat index 1320adc..ecc249b 100644 --- a/tests/conj.dat +++ b/tests/conj.dat @@ -1,6 +1,6 @@ # Data file for mpc_conj. # -# Copyright (C) 2008 INRIA +# Copyright (C) 2008, 2012 INRIA # # This file is part of GNU MPC. # @@ -107,3 +107,8 @@ 0 0 53 +0 53 0x123456789abcdep+52 25 +0 67 -0x123456789abcdep+52 Z D 0 0 53 -0 53 0x123456789abcdep+52 23 -0 68 -0x123456789abcdep+52 U D +# non-exact return values +- - 2 4 2 -8 3 5 3 7 N N +- + 2 4 2 -6 3 5 3 7 D U ++ - 2 6 2 -8 3 5 3 7 U D +- + 2 4 2 -6 3 5 3 7 Z Z diff --git a/tests/fr_sub.dat b/tests/fr_sub.dat index d42b5f3..460e07d 100644 --- a/tests/fr_sub.dat +++ b/tests/fr_sub.dat @@ -1,6 +1,6 @@ # Data file for mpc_fr_sub. # -# Copyright (C) 2008 INRIA +# Copyright (C) 2008, 2012 INRIA # # This file is part of GNU MPC. # @@ -366,3 +366,8 @@ 0 0 7 0 7 -0 7 1 7 1 7 +0 N N 0 0 7 0 7 -1 7 1 7 1 7 1 N N +# inexact return values +- - 2 -8 2 -8 3 1 3 8 3 7 D D +- - 2 -8 2 -8 3 1 3 8 3 7 N N ++ + 2 -6 2 -6 3 1 3 8 3 7 U U ++ + 2 -6 2 -6 3 1 3 8 3 7 Z Z |