summaryrefslogtreecommitdiff
path: root/src/sin_cos.c
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-01-07 19:14:19 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2011-01-07 19:14:19 +0000
commit3b44845cd9e4242651c760ce642feb8ac41b8348 (patch)
tree138a587ada28eb4c9b0eb76b179b9a724a6d378c /src/sin_cos.c
parentc7e1e96458deb786d7db5ec3143445e3ba37085b (diff)
downloadmpc-3b44845cd9e4242651c760ce642feb8ac41b8348.tar.gz
sin and cos call sin_cos also for ordinary arguments
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@859 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'src/sin_cos.c')
-rw-r--r--src/sin_cos.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/sin_cos.c b/src/sin_cos.c
index 20a3d6c..2130495 100644
--- a/src/sin_cos.c
+++ b/src/sin_cos.c
@@ -250,8 +250,6 @@ mpc_sin_cos (mpc_ptr rop_sin, mpc_ptr rop_cos, mpc_srcptr op,
rop_cos may be NULL, in which case it is not computed, and the
corresponding ternary inexact value is set to 0 (exact). */
{
- int inex_sin, inex_cos;
-
if (!mpc_fin_p (op))
return mpc_sin_cos_nonfinite (rop_sin, rop_cos, op, rnd_sin, rnd_cos);
else if (mpfr_zero_p (MPC_IM (op)))
@@ -277,9 +275,13 @@ mpc_sin_cos (mpc_ptr rop_sin, mpc_ptr rop_cos, mpc_srcptr op,
mpfr_t s, c, sh, ch, sch, csh;
mpfr_prec_t prec;
int ok;
- int inex_re, inex_im;
+ int inex_re, inex_im, inex_sin, inex_cos;
- prec = MPC_MAX (MPC_MAX_PREC (rop_sin), MPC_MAX_PREC (rop_cos));
+ prec = 2;
+ if (rop_sin != NULL)
+ prec = MPC_MAX (prec, MPC_MAX_PREC (rop_sin));
+ if (rop_cos != NULL)
+ prec = MPC_MAX (prec, MPC_MAX_PREC (rop_cos));
mpfr_init2 (s, 2);
mpfr_init2 (c, 2);
@@ -370,7 +372,7 @@ mpc_sin_cos (mpc_ptr rop_sin, mpc_ptr rop_cos, mpc_srcptr op,
mpfr_clear (ch);
mpfr_clear (sch);
mpfr_clear (csh);
- }
- return (MPC_INEX12 (inex_sin, inex_cos));
+ return (MPC_INEX12 (inex_sin, inex_cos));
+ }
}