summaryrefslogtreecommitdiff
path: root/mpf/set_d.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>1996-05-24 15:30:16 +0200
committertege <tege@gmplib.org>1996-05-24 15:30:16 +0200
commit2dfedb8813f8f77af2b2393f1fc42af8efba6940 (patch)
treeefe1cf7df8acf18c484cbaf6328f276dc71e8026 /mpf/set_d.c
parent15a52dd576652778ffe4d34b1032b88f2733b3a6 (diff)
downloadgmp-2dfedb8813f8f77af2b2393f1fc42af8efba6940.tar.gz
Finish rewrite.
Diffstat (limited to 'mpf/set_d.c')
-rw-r--r--mpf/set_d.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mpf/set_d.c b/mpf/set_d.c
index 1f2344476..43eb15774 100644
--- a/mpf/set_d.c
+++ b/mpf/set_d.c
@@ -22,12 +22,6 @@ MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
-#if BITS_PER_MP_LIMB == 64
-#define NLIMBS 2
-#else
-#define NLIMBS 3
-#endif
-
void
#if __STDC__
mpf_set_d (mpf_ptr r, double d)
@@ -39,9 +33,15 @@ mpf_set_d (r, d)
{
int negative;
+ if (d == 0)
+ {
+ SIZ(r) = 0;
+ EXP(r) = 0;
+ return;
+ }
negative = d < 0;
d = ABS (d);
EXP(r) = __gmp_extract_double (PTR(r), d);
- SIZ(r) = negative ? -NLIMBS : NLIMBS;
+ SIZ(r) = negative ? -LIMBS_PER_DOUBLE : LIMBS_PER_DOUBLE;
}