mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 03:36:34 +02:00
Issue #519 - allow fixnum results from Cyc_div_op
Need to extend this to fast_div, but this is another good edge case.
This commit is contained in:
parent
14a561a40f
commit
8875c534dc
1 changed files with 6 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue