summaryrefslogtreecommitdiff
path: root/src/sin.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-05-06 16:00:05 +0000
committerthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-05-06 16:00:05 +0000
commit17127f9caa403a13b253159338c798706f3f77dd (patch)
treee923b8377118dfb37824a02e63b69aeb6b7f71b0 /src/sin.c
parent036d29fca7d6b4b790c27644ab6ad891ac988d96 (diff)
downloadmpc-17127f9caa403a13b253159338c798706f3f77dd.tar.gz
Add more tests and fix some bugs for trigonometric functions.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@126 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/sin.c')
-rw-r--r--src/sin.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/sin.c b/src/sin.c
index 2239ce2..c0272d7 100644
--- a/src/sin.c
+++ b/src/sin.c
@@ -100,11 +100,15 @@ mpc_sin (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
return;
}
- /* special case when the input is real: sin(x +/-0*i) = sin(x) +/-0*i */
+ /* special case when the input is real: */
+ /* sin(x -0*i) = sin(x) -0*i*cos(x) */
+ /* sin(x +0*i) = sin(x) +0*i*cos(x) */
if (mpfr_cmp_ui (MPC_IM(op), 0) == 0)
{
- mpfr_sin (MPC_RE(rop), MPC_RE(op), MPC_RND_RE(rnd));
- mpfr_set (MPC_IM(rop), MPC_IM(op), MPC_RND_IM(rnd));
+ mpfr_init (x);
+ mpfr_sin_cos (MPC_RE (rop), x, MPC_RE (op), MPC_RND_RE (rnd));
+ mpfr_mul (MPC_IM(rop), MPC_IM(op), x, MPC_RND_IM(rnd));
+ mpfr_clear (x);
return;
}