summaryrefslogtreecommitdiff
path: root/src/tanh.c
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-12-08 18:55:58 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-12-08 18:55:58 +0000
commit5c2f79eb02db40e789a61b20ac45c8e8ace8058b (patch)
tree1bc1d5346b7e8d480af62004b56bf9083cbfc4d3 /src/tanh.c
parentd1e5e840f5ee9f3c472a3142141e22afa2bb8fb2 (diff)
downloadmpc-5c2f79eb02db40e789a61b20ac45c8e8ace8058b.tar.gz
return values for tanh
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@387 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/tanh.c')
-rw-r--r--src/tanh.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tanh.c b/src/tanh.c
index f2cd7fc..4f0ef54 100644
--- a/src/tanh.c
+++ b/src/tanh.c
@@ -23,24 +23,28 @@ MA 02111-1307, USA. */
#include "mpc.h"
#include "mpc-impl.h"
-void
+int
mpc_tanh (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
{
/* tanh(op) = -i*tan(i*op) = conj(-i*tan(conj(-i*op))) */
mpc_t z;
mpc_t tan_z;
+ int inex;
/* z := conj(-i * op) and rop = conj(-i * tan(z)), in other words, we have
- to switch real and imaginary parts. Let us set them without copying
+ to switch real and imaginary parts. Let us set them without copying
significands. */
MPC_RE (z)[0] = MPC_IM (op)[0];
MPC_IM (z)[0] = MPC_RE (op)[0];
MPC_RE (tan_z)[0] = MPC_IM (rop)[0];
MPC_IM (tan_z)[0] = MPC_RE (rop)[0];
- mpc_tan (tan_z, z, RNDC (MPC_RND_IM (rnd), MPC_RND_RE (rnd)));
+ inex = mpc_tan (tan_z, z, RNDC (MPC_RND_IM (rnd), MPC_RND_RE (rnd)));
/* tan_z and rop parts share the same significands, copy the rest now. */
MPC_RE (rop)[0] = MPC_IM (tan_z)[0];
MPC_IM (rop)[0] = MPC_RE (tan_z)[0];
+
+ /* swap inexact flags for real and imaginary parts */
+ return MPC_INEX (MPC_INEX_IM (inex), MPC_INEX_RE (inex));
}