diff options
author | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-12-08 18:55:58 +0000 |
---|---|---|
committer | enge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2008-12-08 18:55:58 +0000 |
commit | 5c2f79eb02db40e789a61b20ac45c8e8ace8058b (patch) | |
tree | 1bc1d5346b7e8d480af62004b56bf9083cbfc4d3 /src/tanh.c | |
parent | d1e5e840f5ee9f3c472a3142141e22afa2bb8fb2 (diff) | |
download | mpc-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.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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)); } |