summaryrefslogtreecommitdiff
path: root/div_2exp.c
diff options
context:
space:
mode:
Diffstat (limited to 'div_2exp.c')
-rw-r--r--div_2exp.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/div_2exp.c b/div_2exp.c
index 691fb1be4..3a9f67e21 100644
--- a/div_2exp.c
+++ b/div_2exp.c
@@ -24,33 +24,12 @@ MA 02111-1307, USA. */
#include "mpfr.h"
#include "mpfr-impl.h"
+/* Obsolete function, use mpfr_div_2ui or mpfr_div_2si instead. */
+
+#undef mpfr_div_2exp
+
int
mpfr_div_2exp (mpfr_ptr y, mpfr_srcptr x, unsigned long int n, mp_rnd_t rnd_mode)
{
- int inexact;
-
- inexact = y != x ? mpfr_set (y, x, rnd_mode) : 0;
-
- if (MPFR_IS_FP(y) && MPFR_NOTZERO(y))
- {
- /* n will have to be casted to long to make sure that the addition
- and subtraction below (for overflow detection) are signed */
- while (n > LONG_MAX)
- {
- int inex2;
-
- n -= LONG_MAX;
- inex2 = mpfr_div_2exp(y, y, LONG_MAX, rnd_mode);
- if (inex2)
- return inex2; /* underflow */
- }
-
- if (__mpfr_emin > MPFR_EMAX_MAX - (long) n ||
- MPFR_EXP(y) < __mpfr_emin + (long) n)
- return mpfr_set_underflow (y, rnd_mode, MPFR_SIGN(y));
-
- MPFR_EXP(y) -= (long) n;
- }
-
- return inexact;
+ return mpfr_div_2ui (y, x, n, rnd_mode);
}