py/modmath: Work around msvc float bugs in atan2, fmod and modf.

Older implementations deal with infinity/negative zero incorrectly.  This
commit adds generic fixes that can be enabled by any port that needs them,
along with new tests cases.
This commit is contained in:
stijn
2020-05-17 12:29:25 +02:00
committed by Damien George
parent a902b69dd5
commit 81db22f693
4 changed files with 51 additions and 3 deletions

View File

@@ -1128,6 +1128,21 @@ typedef double mp_float_t;
#define MICROPY_PY_MATH_ISCLOSE (0)
#endif
// Whether to provide fix for atan2 Inf handling.
#ifndef MICROPY_PY_MATH_ATAN2_FIX_INFNAN
#define MICROPY_PY_MATH_ATAN2_FIX_INFNAN (0)
#endif
// Whether to provide fix for fmod Inf handling.
#ifndef MICROPY_PY_MATH_FMOD_FIX_INFNAN
#define MICROPY_PY_MATH_FMOD_FIX_INFNAN (0)
#endif
// Whether to provide fix for modf negative zero handling.
#ifndef MICROPY_PY_MATH_MODF_FIX_NEGZERO
#define MICROPY_PY_MATH_MODF_FIX_NEGZERO (0)
#endif
// Whether to provide "cmath" module
#ifndef MICROPY_PY_CMATH
#define MICROPY_PY_CMATH (0)