mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Should return +/- infinity for float division by zero.
This commit is contained in:
@@ -901,6 +901,8 @@ fix_mod(mrb_state *mrb, mrb_value x)
|
||||
/* ZeroDivisionError */
|
||||
return mrb_fixnum_value(0);
|
||||
#else
|
||||
if (a > 0) return mrb_float_value(mrb, INFINITY);
|
||||
if (a < 0) return mrb_float_value(mrb, INFINITY);
|
||||
return mrb_float_value(mrb, NAN);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user