summaryrefslogtreecommitdiff
path: root/src/sin.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-04-22 09:41:43 +0000
committerthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2008-04-22 09:41:43 +0000
commitb35d3805ad6ec682fdc241ea270e896cb386161e (patch)
tree1e4c4838f26d0c662923f0b01900ac53d3ccecf7 /src/sin.c
parentab49659dc541afdf1431a66346e29b547d2f6bbd (diff)
downloadmpc-b35d3805ad6ec682fdc241ea270e896cb386161e.tar.gz
Fix sign of zero in mpc_sin.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@116 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/sin.c')
-rw-r--r--src/sin.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sin.c b/src/sin.c
index 047a35e..5561045 100644
--- a/src/sin.c
+++ b/src/sin.c
@@ -86,18 +86,19 @@ mpc_sin (mpc_ptr rop, mpc_srcptr op, mpc_rnd_t rnd)
return;
}
- /* special case when the input is real: sin(x) = sin(x) */
+ /* special case when the input is real: sin(x +/-0*i) = sin(x) +/-0*i */
if (mpfr_cmp_ui (MPC_IM(op), 0) == 0)
{
mpfr_sin (MPC_RE(rop), MPC_RE(op), MPC_RND_RE(rnd));
- mpfr_set_ui (MPC_IM(rop), 0, MPC_RND_IM(rnd));
+ mpfr_set (MPC_IM(rop), MPC_IM(op), MPC_RND_IM(rnd));
return;
}
- /* special case when the input is imaginary: sin(I*y) = sinh(y)*I */
+ /* special case when the input is imaginary:
+ sin(+/-O +i*y) = +/-0 +i*sinh(y) */
if (mpfr_cmp_ui (MPC_RE(op), 0) == 0)
{
- mpfr_set_ui (MPC_RE(rop), 0, MPC_RND_RE(rnd));
+ mpfr_set (MPC_RE(rop), MPC_RE(op), MPC_RND_RE(rnd));
mpfr_sinh (MPC_IM(rop), MPC_IM(op), MPC_RND_IM(rnd));
return;
}