Commit 040b57fa authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

1 % 0 should return NaN; close #283

parent c7b1622f
...@@ -767,12 +767,11 @@ static mrb_value ...@@ -767,12 +767,11 @@ static mrb_value
fix_mod(mrb_state *mrb, mrb_value x) fix_mod(mrb_state *mrb, mrb_value x)
{ {
mrb_value y; mrb_value y;
mrb_int a; mrb_int a, b;
mrb_get_args(mrb, "o", &y); mrb_get_args(mrb, "o", &y);
a = mrb_fixnum(x); a = mrb_fixnum(x);
if (FIXNUM_P(y)) { if (FIXNUM_P(y) && (b=mrb_fixnum(y)) != 0) {
mrb_int mod; mrb_int mod;
fixdivmod(mrb, a, mrb_fixnum(y), 0, &mod); fixdivmod(mrb, a, mrb_fixnum(y), 0, &mod);
......
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