From ca80aabf21eac1d97f108ad7ed86ff3426f88449 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 10 Jun 2025 22:15:37 +1000 Subject: py/objfloat: Change MSVC workaround for NAN being a constant. It's actually a bug in the Windows SDK, not MSVC, as per https://stackoverflow.com/questions/79195142/recent-msvc-versions-dont-treat-nan-as-constant-workaround/79324199#79324199 Thanks to @stinos. Signed-off-by: Damien George --- py/objfloat.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'py/objfloat.c') diff --git a/py/objfloat.c b/py/objfloat.c index 0728fce31..81b0daa62 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -34,6 +34,11 @@ #if MICROPY_PY_BUILTINS_FLOAT +// Workaround a bug in Windows SDK version 10.0.26100.0, where NAN is no longer constant. +#if defined(_MSC_VER) && !defined(_UCRT_NOISY_NAN) +#define _UCRT_NOISY_NAN +#endif + #include #include "py/formatfloat.h" @@ -47,13 +52,6 @@ #define M_PI (3.14159265358979323846) #endif -// Workaround a bug in recent MSVC where NAN is no longer constant. -// (By redefining back to the previous MSVC definition of NAN) -#if defined(_MSC_VER) && _MSC_VER >= 1942 -#undef NAN -#define NAN (-(float)(((float)(1e+300 * 1e+300)) * 0.0F)) -#endif - typedef struct _mp_obj_float_t { mp_obj_base_t base; mp_float_t value; -- cgit v1.2.3