summaryrefslogtreecommitdiff
path: root/hypot.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-11-18 14:52:59 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-11-18 14:52:59 +0000
commit054cdf7c885c574e6c111003c8767575a2a44666 (patch)
tree49713e889d7f8ccbdad01a07e92ff3cdf8f9c27e /hypot.c
parentef4cc77a66014090216445e952b0ccb9fc461e46 (diff)
downloadmpfr-054cdf7c885c574e6c111003c8767575a2a44666.tar.gz
Replace use of mpfr_save_emin_emax () / mpfr_restore_emin_emax()
by MPFR_SAVE_EXPO macros (DECL, MARK and FREE) which are faster and thread safe. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3100 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'hypot.c')
-rw-r--r--hypot.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/hypot.c b/hypot.c
index ed19112aa..7403503a7 100644
--- a/hypot.c
+++ b/hypot.c
@@ -22,10 +22,8 @@ MA 02111-1307, USA. */
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
- /* The computation of hypot of x and y is done by
-
- hypot(x,y)= sqrt(x^2+y^2) = z
- */
+/* The computation of hypot of x and y is done by *
+ * hypot(x,y)= sqrt(x^2+y^2) = z */
int
mpfr_hypot (mpfr_ptr z, mpfr_srcptr x , mpfr_srcptr y , mp_rnd_t rnd_mode)
@@ -38,6 +36,7 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x , mpfr_srcptr y , mp_rnd_t rnd_mode)
mp_prec_t Nt; /* precision of the intermediary variable */
mp_exp_t Ex, Ey, sh;
mp_exp_unsigned_t diff_exp;
+ MPFR_SAVE_EXPO_DECL (expo);
/* particular cases */
if (MPFR_ARE_SINGULAR(x,y))
@@ -115,9 +114,9 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x , mpfr_srcptr y , mp_rnd_t rnd_mode)
mpfr_init (te);
mpfr_init (ti);
- mpfr_save_emin_emax ();
+ MPFR_SAVE_EXPO_MARK (expo);
- sh = MAX(0,MIN(Ex,Ey));
+ sh = MAX (0, MIN (Ex, Ey));
do
{
@@ -165,7 +164,7 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x , mpfr_srcptr y , mp_rnd_t rnd_mode)
1 non zero ternary flag given by inexact
*/
- mpfr_restore_emin_emax ();
+ MPFR_SAVE_EXPO_FREE (expo);
return mpfr_check_range (z, inexact, rnd_mode);
}