py/modmath: Make MICROPY_PY_MATH_POW_FIX_NAN also fix pow(x, NaN) cases.

This is needed by the zephyr port.  Combining it with the existing
`MICROPY_PY_MATH_POW_FIX_NAN` option should be safe, and eliminates the
need for a separate option.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-10-01 12:21:27 +10:00
parent 381cd730c8
commit dcbda765d1
3 changed files with 10 additions and 1 deletions

View File

@@ -301,6 +301,10 @@ mp_obj_t mp_obj_float_binary_op(mp_binary_op_t op, mp_float_t lhs_val, mp_obj_t
lhs_val = MICROPY_FLOAT_CONST(1.0);
break;
}
if (isnan(rhs_val)) {
lhs_val = rhs_val;
break;
}
#endif
lhs_val = MICROPY_FLOAT_C_FUN(pow)(lhs_val, rhs_val);
break;