summaryrefslogtreecommitdiff
path: root/get_d.c
diff options
context:
space:
mode:
Diffstat (limited to 'get_d.c')
-rw-r--r--get_d.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/get_d.c b/get_d.c
index efdd31946..34d1ce27f 100644
--- a/get_d.c
+++ b/get_d.c
@@ -26,15 +26,12 @@ MA 02111-1307, USA. */
#include "longlong.h"
#include "mpfr.h"
#include "mpfr-impl.h"
+#include "mpfr-math.h"
static double __mpfr_scale2 _PROTO ((double, int));
#define IEEE_DBL_MANT_DIG 53
-#define NaN (0./0.) /* ensures a machine-independent NaN */
-#define Infp (1/0.)
-#define Infm (-1/0.)
-
static double
__mpfr_scale2 (double d, int exp)
{
@@ -102,12 +99,12 @@ mpfr_get_d3 (mpfr_srcptr src, mp_exp_t e, mp_rnd_t rnd_mode)
int negative;
if (MPFR_IS_NAN(src))
- return NaN;
+ return MPFR_DBL_NAN;
negative = MPFR_SIGN(src) < 0;
if (MPFR_IS_INF(src))
- return negative ? Infm : Infp;
+ return negative ? MPFR_DBL_INFM : MPFR_DBL_INFP;
if (MPFR_IS_ZERO(src))
return negative ? -0.0 : 0.0;
@@ -121,8 +118,10 @@ mpfr_get_d3 (mpfr_srcptr src, mp_exp_t e, mp_rnd_t rnd_mode)
else if (e > 1024)
{
d = negative ?
- (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDU ? -DBL_MAX : Infm) :
- (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDD ? DBL_MAX : Infp);
+ (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDU ?
+ -DBL_MAX : MPFR_DBL_INFM) :
+ (rnd_mode == GMP_RNDZ || rnd_mode == GMP_RNDD ?
+ DBL_MAX : MPFR_DBL_INFP);
}
else
{