Issue #519 - fix bignum TODO's in Cyc_remainder

This commit is contained in:
Justin Ethier 2024-01-07 19:40:32 -08:00
parent 38276ffd46
commit 88fb4b909f

View file

@ -4660,11 +4660,9 @@ void Cyc_remainder(void *data, object cont, object num1, object num2)
Cyc_bignum_remainder(data, cont, num1, num2, rem); Cyc_bignum_remainder(data, cont, num1, num2, rem);
} }
else if (is_object_type(num2) && type_of(num2) == double_tag){ else if (is_object_type(num2) && type_of(num2) == double_tag){
// TODO: correct to convert bignum to double here ii = mp_get_double(&bignum_value(num1));
j = ((double_type *)num2)->value; jj = ((double_type *)num2)->value;
alloc_bignum(data, bn); goto handledouble;
Cyc_int2bignum(obj_obj2int(j), &(bn->bn));
Cyc_bignum_remainder(data, cont, num1, bn, bn);
} }
else { else {
goto typeerror; goto typeerror;
@ -4676,11 +4674,9 @@ void Cyc_remainder(void *data, object cont, object num1, object num2)
goto handledouble; goto handledouble;
} }
else if (is_object_type(num2) && type_of(num2) == bignum_tag){ else if (is_object_type(num2) && type_of(num2) == bignum_tag){
// TODO: convert bignum to double here ii = ((double_type *)num1)->value;
i = ((double_type *)num1)->value; jj = mp_get_double(&bignum_value(num2));
alloc_bignum(data, bn); goto handledouble;
Cyc_int2bignum(obj_obj2int(i), &(bn->bn));
Cyc_bignum_remainder(data, cont, bn, num2, bn);
} }
else if (is_object_type(num2) && type_of(num2) == double_tag){ else if (is_object_type(num2) && type_of(num2) == double_tag){
ii = ((double_type *)num1)->value; ii = ((double_type *)num1)->value;