mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* num2float.i.c (NUM2FLOAT): handle GMP bignums.
This commit is contained in:
parent
4ef36fb822
commit
78c53d7e61
1 changed files with 1 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue