Commit 7d167327 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

zero check before overflow check devision; close #446

parent dabe3ca0
...@@ -1360,7 +1360,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self) ...@@ -1360,7 +1360,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
x = mrb_fixnum(regs[a]); x = mrb_fixnum(regs[a]);
y = mrb_fixnum(regs[a+1]); y = mrb_fixnum(regs[a+1]);
z = x * y; z = x * y;
if (z/x != y) { if (x != 0 && z/x != y) {
regs[a] = mrb_float_value((mrb_float)x * (mrb_float)y); regs[a] = mrb_float_value((mrb_float)x * (mrb_float)y);
} }
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment