diff options
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2389,8 +2389,10 @@ RETRY_TRY_BLOCK: mrb_int x = mrb_fixnum(regs[a]); mrb_int y = mrb_fixnum(regs[a+1]); double f; - if (y == 0 && x != 0) { - f = INFINITY; + if (y == 0) { + if (x == 0) f = NAN; + else if (x > 0) f = INFINITY; + else if (x < 0) f = -INFINITY; } else { f = (mrb_float)x / (mrb_float)y; |
