forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid naming nonstandard <ymath.h> to retrieve a NaN constant, as tha…
…t header is no longer #includable from C. (microsoft#7979)
- Loading branch information
1 parent
dc61560
commit fdbd3b5
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git "a/lib/csa/nan.h" "b/lib/csa/nan.h" | ||
index 29fd3d2f..7f16e8c8 100644 | ||
--- "a/lib/csa/nan.h" | ||
+++ "b/lib/csa/nan.h" | ||
@@ -19,6 +19,16 @@ | ||
#if !defined ( _NAN_H ) | ||
#define _NAN_H | ||
|
||
+// Try to use the implementation-provided NAN constant: | ||
+ | ||
+#include <math.h> | ||
+ | ||
+#if defined(NAN) | ||
+ | ||
+#define NaN ((double)NAN) | ||
+ | ||
+#else // ^^^ implementation provides NAN // implementation does not provide NAN vvv | ||
+ | ||
#if ( defined ( __GNUC__ ) && !defined ( __ICC ) ) || defined ( __BORLANDC__ ) | ||
|
||
static const double NaN = 0.0 / 0.0; | ||
@@ -63,4 +73,6 @@ static const long long lNaN = ( (unsigned long long) 1 << 63 ) - 1; | ||
|
||
#endif | ||
|
||
+#endif // defined(NAN) | ||
+ | ||
#endif |