summaryrefslogtreecommitdiff
path: root/py/objfloat.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-06-10 22:15:37 +1000
committerDamien George <damien@micropython.org>2025-06-11 00:43:31 +1000
commitca80aabf21eac1d97f108ad7ed86ff3426f88449 (patch)
treea40b1bfa34e4f901acfa6022a7a0dfdf61fe6aa6 /py/objfloat.c
parent2ce63b142068fc04aae701ae78af683736dc179c (diff)
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 <damien@micropython.org>
Diffstat (limited to 'py/objfloat.c')
-rw-r--r--py/objfloat.c12
1 files changed, 5 insertions, 7 deletions
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 <math.h>
#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;