No need for duplicate definition of mp_get_double

This commit is contained in:
Justin Ethier 2019-10-18 12:55:18 -04:00
parent 676187078f
commit 864dc9f9c5
2 changed files with 0 additions and 19 deletions

View file

@ -1444,7 +1444,6 @@ void **vpbuffer_add(void **buf, int *len, int i, void *obj);
void vpbuffer_free(void **buf);
/* Bignum utility functions */
double mp_get_double(const mp_int *a);
int Cyc_bignum_cmp(bn_cmp_type type, object x, int tx, object y, int ty);
void Cyc_int2bignum(int n, mp_int *bn);

View file

@ -1478,24 +1478,6 @@ object Cyc_num_cmp_va_list(void *data, int argc,
return boolean_t;
}
/**
* Convert from a bignum to a double
* Code is from: https://github.com/libtom/libtommath/issues/3
*/
#define PRECISION 53
double mp_get_double(const mp_int *a)
{
int i;
double d = 0.0, fac = 1.0;
for (i = 0; i < DIGIT_BIT; ++i) {
fac *= 2.0;
}
for (i = a->used; i --> 0;) {
d = (d * fac) + (double)DIGIT(a, i);
}
return (a->sign == MP_NEG) ? -d : d;
}
// Convert a bignum back to fixnum if possible
object Cyc_bignum_normalize(void *data, object n)
{