summaryrefslogtreecommitdiff
path: root/src/atan2.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2011-01-17 03:06:09 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2011-01-17 03:06:09 +0000
commite4a4588ef2e65bc3b6930f68082b710872aaa8c9 (patch)
treef464dbd0ed3912e7b12d18b24f220bf5b882378c /src/atan2.c
parente208b83c142da228304fb0298ecdca0e29e18d5d (diff)
downloadmpfr-e4a4588ef2e65bc3b6930f68082b710872aaa8c9.tar.gz
[src/atan2.c] MPFR_EXP -> MPFR_GET_EXP and reformat.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7392 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/atan2.c')
-rw-r--r--src/atan2.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/atan2.c b/src/atan2.c
index f2425a0f3..d299fa507 100644
--- a/src/atan2.c
+++ b/src/atan2.c
@@ -156,22 +156,24 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
/* When x is a power of two, we call directly atan(y/x) since y/x is
exact. */
- if (MPFR_UNLIKELY (MPFR_IS_POWER_OF_2 (x)))
+ if (MPFR_UNLIKELY (MPFR_IS_POWER_OF_2 (x)))
{
int r;
mpfr_t yoverx;
+
mpfr_init2 (yoverx, MPFR_PREC (y));
- if (MPFR_LIKELY (mpfr_div_2si (yoverx, y, MPFR_EXP (x) - 1, MPFR_RNDN) == 0))
- {
- r = mpfr_atan (dest, yoverx, rnd_mode);
- mpfr_clear (yoverx);
- return r;
- }
+ if (MPFR_LIKELY (mpfr_div_2si (yoverx, y, MPFR_GET_EXP (x) - 1,
+ MPFR_RNDN) == 0))
+ {
+ r = mpfr_atan (dest, yoverx, rnd_mode);
+ mpfr_clear (yoverx);
+ return r;
+ }
else
- {
- /* Division is inexact because of a small exponent range */
- mpfr_clear (yoverx);
- }
+ {
+ /* Division is inexact because of a small exponent range */
+ mpfr_clear (yoverx);
+ }
}
MPFR_SAVE_EXPO_MARK (expo);