Issue #519 - numerator/denominator

Return fixnum or bignum values from this function when they are passed as arg, per R7RS.
This commit is contained in:
Justin Ethier 2024-01-07 07:44:04 -08:00
parent ffcbca6c3e
commit d048b3d4f0

View file

@ -8636,6 +8636,12 @@ void Cyc_get_ratio(void *data, object cont, object n, int numerator)
// Special case
make_double(val, 1.0);
return_closcall1(data, cont, &val);
} else if (obj_is_int(n) || type_of(n) == bignum_tag) {
if (numerator) {
return_closcall1(data, cont, n);
} else {
return_closcall1(data, cont, obj_int2obj((1)));
}
} else {
double numer, denom;
make_double(val, 0.0);