summaryrefslogtreecommitdiff
path: root/atan2.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-07-18 13:51:07 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-07-18 13:51:07 +0000
commit72abdbf55209579b5f4db97a95037ef43800d08a (patch)
treec2f67a08df3257515189ad6c0a5dfda3e04dd750 /atan2.c
parent17adbb9252c7cf03a822235405b4e0d1c4778740 (diff)
downloadmpfr-72abdbf55209579b5f4db97a95037ef43800d08a.tar.gz
atan2.c: quick-and-dirty fix for atan2(y,1)
tests/tatan.c: fix tests from Christopher [x and y were interchanged] git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4646 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'atan2.c')
-rw-r--r--atan2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/atan2.c b/atan2.c
index cbbf292e7..0f5c9175d 100644
--- a/atan2.c
+++ b/atan2.c
@@ -153,6 +153,12 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
else
goto set_zero;
}
+
+ /* When x=1, atan2(y,x) = atan(y). FIXME: more generally, if x is a power
+ of two, we could call directly atan(y/x) since y/x is exact. */
+ if (mpfr_cmp_ui (x, 1) == 0)
+ return mpfr_atan (dest, y, rnd_mode);
+
MPFR_SAVE_EXPO_MARK (expo);
/* Set up initial prec */