summaryrefslogtreecommitdiff
path: root/libguile/num2float.i.c
diff options
context:
space:
mode:
authorRob Browning <rlb@defaultvalue.org>2003-04-04 21:49:03 +0000
committerRob Browning <rlb@defaultvalue.org>2003-04-04 21:49:03 +0000
commit78c53d7e616fe1d9f4ff74cd7c010d4cf2544dbb (patch)
tree284cd4b212654282bc0aa1918ddc8481e8d5500a /libguile/num2float.i.c
parent4ef36fb8226c7688a22e02491412d6334f1bd547 (diff)
downloadguile-78c53d7e616fe1d9f4ff74cd7c010d4cf2544dbb.tar.gz
* num2float.i.c (NUM2FLOAT): handle GMP bignums.
Diffstat (limited to 'libguile/num2float.i.c')
-rw-r--r--libguile/num2float.i.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/libguile/num2float.i.c b/libguile/num2float.i.c
index 08687a875..5ef3a30cf 100644
--- a/libguile/num2float.i.c
+++ b/libguile/num2float.i.c
@@ -7,16 +7,7 @@ NUM2FLOAT (SCM num, unsigned long int pos, const char *s_caller)
return SCM_INUM (num);
else if (SCM_BIGP (num))
{ /* bignum */
-
- FTYPE res = 0.0;
- size_t l;
-
- for (l = SCM_NUMDIGS (num); l--;)
- res = SCM_BIGRAD * res + SCM_BDIGITS (num)[l];
-
- if (SCM_BIGSIGN (num))
- res = -res;
-
+ FTYPE res = mpz_get_d (SCM_I_BIG_MPZ (num));
if (isfinite (res))
return res;
else
@@ -32,7 +23,6 @@ SCM
FLOAT2NUM (FTYPE n)
{
SCM z = scm_double_cell (scm_tc16_real, 0, 0, 0);
-
SCM_REAL_VALUE (z) = n;
return z;
}