summaryrefslogtreecommitdiff
path: root/get_d.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-03-19 08:47:22 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-03-19 08:47:22 +0000
commit5c2d7b8d0bc002cd54311f6a2cd81c7c583fed81 (patch)
tree3d716b1671752b7dab06497a300de6fc776d91ee /get_d.c
parentc4d4273ebb042c292b84e32018a2e7b77ccf409e (diff)
downloadmpfr-5c2d7b8d0bc002cd54311f6a2cd81c7c583fed81.tar.gz
Macros MPFR_DBL_NAN, MPFR_DBL_INFP and MPFR_DBL_INFM.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1754 280ebfd0-de03-0410-8827-d642c229c3f4
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
{