On python3 log(0) raises math domain error, not zerodivisionerror
This commit is contained in:
parent
0e19fbb60f
commit
f67bca94c4
@ -371,7 +371,7 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
|
|||||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
} else if (base == (mp_float_t)1.0) {
|
} else if (base == (mp_float_t)1.0) {
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
mp_raise_msg(&mp_type_ZeroDivisionError, translate("division by zero"));
|
math_error();
|
||||||
}
|
}
|
||||||
return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base));
|
return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user