py: Fix handling of NaN in certain pow implementations.

Adds a new compile-time option MICROPY_PY_MATH_POW_FIX_NAN for use with
toolchains that don't handle pow-of-NaN correctly.
This commit is contained in:
stijn
2020-09-08 15:22:34 +02:00
committed by Damien George
parent 8d5a40c86e
commit 2e54d9d146
5 changed files with 26 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ for name, f, args in (
# double argument functions
for name, f, args in (
("pow", math.pow, ((0, 2), (-1, 2), (0, -1), (-1, 2.3))),
("pow", math.pow, ((0, 2), (-1, 2), (0, -1), (-1, 2.3), (nan, 0), (1, nan))),
("fmod", math.fmod, ((1.2, inf), (1.2, -inf), (1.2, 0), (inf, 1.2))),
("atan2", math.atan2, ((0, 0), (-inf, inf), (-inf, -inf), (inf, -inf))),
("copysign", math.copysign, ()),