mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[CRT] math.h: fix definition of NAN
- Use positive NAN by default - add support for _UCRT_NEGATIVE_NAN to legacy CRT headers - Use __builtin_nanf() on GCC/Clang
This commit is contained in:
parent
2fca81eca8
commit
736fea6c44
2 changed files with 23 additions and 1 deletions
|
@ -57,7 +57,21 @@ typedef double double_t;
|
|||
#define HUGE_VALD ((double)INFINITY)
|
||||
#define HUGE_VALF ((float)INFINITY)
|
||||
#define HUGE_VALL ((long double)INFINITY)
|
||||
#define NAN ((float)(INFINITY * 0.0F))
|
||||
#ifndef _UCRT_NEGATIVE_NAN
|
||||
// This operation creates a negative NAN adding a - to make it positive
|
||||
#ifdef _MSC_VER
|
||||
#define NAN (-(float)(INFINITY * 0.0F))
|
||||
#else
|
||||
#define NAN (__builtin_nanf(""))
|
||||
#endif
|
||||
#else
|
||||
// Keep this for backwards compatibility
|
||||
#ifdef _MSC_VER
|
||||
#define NAN ((float)(INFINITY * 0.0F))
|
||||
#else
|
||||
#define NAN (-__builtin_nanf(""))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _DENORM (-2)
|
||||
#define _FINITE (-1)
|
||||
|
|
|
@ -91,10 +91,18 @@ _CRT_BEGIN_C_HEADER
|
|||
#define HUGE_VALL ((long double)INFINITY)
|
||||
#ifndef _UCRT_NEGATIVE_NAN
|
||||
// This operation creates a negative NAN adding a - to make it positive
|
||||
#ifdef _MSC_VER
|
||||
#define NAN (-(float)(INFINITY * 0.0F))
|
||||
#else
|
||||
#define NAN (__builtin_nanf(""))
|
||||
#endif
|
||||
#else
|
||||
// Keep this for backwards compatibility
|
||||
#ifdef _MSC_VER
|
||||
#define NAN ((float)(INFINITY * 0.0F))
|
||||
#else
|
||||
#define NAN (-__builtin_nanf(""))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _DENORM (-2)
|
||||
|
|
Loading…
Reference in a new issue