Skip to content

Commit ca80aab

Browse files
committed
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 <[email protected]>
1 parent 2ce63b1 commit ca80aab

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

py/objfloat.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434

3535
#if MICROPY_PY_BUILTINS_FLOAT
3636

37+
// Workaround a bug in Windows SDK version 10.0.26100.0, where NAN is no longer constant.
38+
#if defined(_MSC_VER) && !defined(_UCRT_NOISY_NAN)
39+
#define _UCRT_NOISY_NAN
40+
#endif
41+
3742
#include <math.h>
3843
#include "py/formatfloat.h"
3944

@@ -47,13 +52,6 @@
4752
#define M_PI (3.14159265358979323846)
4853
#endif
4954

50-
// Workaround a bug in recent MSVC where NAN is no longer constant.
51-
// (By redefining back to the previous MSVC definition of NAN)
52-
#if defined(_MSC_VER) && _MSC_VER >= 1942
53-
#undef NAN
54-
#define NAN (-(float)(((float)(1e+300 * 1e+300)) * 0.0F))
55-
#endif
56-
5755
typedef struct _mp_obj_float_t {
5856
mp_obj_base_t base;
5957
mp_float_t value;

0 commit comments

Comments
 (0)