py/objfloat: Fix case of raising 0 to -infinity.

It was raising an exception but it should return infinity.
This commit is contained in:
Damien George
2018-02-08 14:35:43 +11:00
parent b75cb8392b
commit bbb08431f3
2 changed files with 12 additions and 1 deletions

View File

@@ -293,7 +293,7 @@ mp_obj_t mp_obj_float_binary_op(mp_binary_op_t op, mp_float_t lhs_val, mp_obj_t
break;
case MP_BINARY_OP_POWER:
case MP_BINARY_OP_INPLACE_POWER:
if (lhs_val == 0 && rhs_val < 0) {
if (lhs_val == 0 && rhs_val < 0 && !isinf(rhs_val)) {
goto zero_division_error;
}
if (lhs_val < 0 && rhs_val != MICROPY_FLOAT_C_FUN(floor)(rhs_val)) {