mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Float#divmod with zero should cause ZeroDivisionError; #5384
This commit is contained in:
+2
-6
@@ -375,13 +375,9 @@ flodivmod(mrb_state *mrb, double x, double y, mrb_float *divp, mrb_float *modp)
|
||||
goto exit;
|
||||
}
|
||||
if (y == 0.0) {
|
||||
if (x == 0) div = NAN;
|
||||
else if (x > 0.0) div = INFINITY;
|
||||
else div = -INFINITY; /* x < 0.0 */
|
||||
mod = NAN;
|
||||
goto exit;
|
||||
int_zerodiv(mrb);
|
||||
}
|
||||
if ((x == 0.0) || (isinf(y) && !isinf(x))) {
|
||||
if (isinf(y) && !isinf(x)) {
|
||||
mod = x;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user