mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 21:11:12 +02:00
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>
This commit is contained in:
@@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
#if MICROPY_PY_BUILTINS_FLOAT
|
#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 <math.h>
|
||||||
#include "py/formatfloat.h"
|
#include "py/formatfloat.h"
|
||||||
|
|
||||||
@@ -47,13 +52,6 @@
|
|||||||
#define M_PI (3.14159265358979323846)
|
#define M_PI (3.14159265358979323846)
|
||||||
#endif
|
#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 {
|
typedef struct _mp_obj_float_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
mp_float_t value;
|
mp_float_t value;
|
||||||
|
Reference in New Issue
Block a user