Skip to content

Commit

Permalink
Issue #519 - numerator/denominator
Browse files Browse the repository at this point in the history
Return fixnum or bignum values from this function when they are passed as arg, per R7RS.
  • Loading branch information
justinethier committed Jan 7, 2024
1 parent ffcbca6 commit d048b3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d048b3d

Please sign in to comment.