Skip to content

Commit

Permalink
Issue #519 - allow fixnum results from Cyc_div_op
Browse files Browse the repository at this point in the history
Need to extend this to fast_div, but this is another good edge case.
  • Loading branch information
justinethier committed Jan 6, 2024
1 parent 14a561a commit 8875c53
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 @@ -4241,6 +4241,12 @@ object Cyc_div_op(void *data, common_type * x, object y)
}
x->double_t.tag = double_tag;
x->double_t.value = ((double)x->integer_t.value) / (obj_obj2int(y));

if (x->double_t.value == round(x->double_t.value)) {
int tmp = x->double_t.value;
x->integer_t.tag = integer_tag;
x->integer_t.value = tmp;
}
} else if (tx == double_tag && ty == -1) {
x->double_t.value = x->double_t.value / (obj_obj2int(y));
} else if (tx == integer_tag && ty == integer_tag) {
Expand Down

0 comments on commit 8875c53

Please sign in to comment.