Return `NaN` for `0/0`; d8e060d2

parent ad8b36da
...@@ -166,9 +166,12 @@ integral_div(mrb_state *mrb, mrb_value xv) ...@@ -166,9 +166,12 @@ integral_div(mrb_state *mrb, mrb_value xv)
x = mrb_to_flo(mrb, xv); x = mrb_to_flo(mrb, xv);
if (y == 0) { if (y == 0) {
if (x < 0) if (x < 0)
return mrb_float_value(mrb, -INFINITY); y = -INFINITY;
else else if (x > 0)
return mrb_float_value(mrb, INFINITY); y = INFINITY;
else /* if (x == 0) */
y = NAN;
return mrb_float_value(mrb, y);
} }
return mrb_float_value(mrb, x / y); return mrb_float_value(mrb, x / y);
#endif #endif
......
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