summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibJS/Runtime/Value.h3
-rw-r--r--Libraries/LibM/math.cpp4
-rw-r--r--Libraries/LibM/math.h1
3 files changed, 5 insertions, 3 deletions
diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h
index 46520b00e6..4fc78516f0 100644
--- a/Libraries/LibJS/Runtime/Value.h
+++ b/Libraries/LibJS/Runtime/Value.h
@@ -32,6 +32,7 @@
#include <AK/Types.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Symbol.h>
+#include <math.h>
// 2 ** 53 - 1
static constexpr double MAX_ARRAY_LIKE_INDEX = 9007199254740991.0;
@@ -251,7 +252,7 @@ inline Value js_null()
inline Value js_nan()
{
- return Value(__builtin_nan(""));
+ return Value(NAN);
}
inline Value js_infinity()
diff --git a/Libraries/LibM/math.cpp b/Libraries/LibM/math.cpp
index 021993e9d4..77d385ab43 100644
--- a/Libraries/LibM/math.cpp
+++ b/Libraries/LibM/math.cpp
@@ -211,7 +211,7 @@ double log10(double x)
double log(double x)
{
if (x < 0)
- return __builtin_nan("");
+ return NAN;
if (x == 0)
return -__builtin_huge_val();
double y = 1 + 2 * (x - 1) / (x + 1);
@@ -321,7 +321,7 @@ double atan(double x)
double asin(double x)
{
if (x > 1 || x < -1)
- return __builtin_nan("");
+ return NAN;
if (x > 0.5 || x < -0.5)
return 2 * atan(x / (1 + sqrt(1 - x * x)));
double squared = x * x;
diff --git a/Libraries/LibM/math.h b/Libraries/LibM/math.h
index 767ec33649..5a4de08eac 100644
--- a/Libraries/LibM/math.h
+++ b/Libraries/LibM/math.h
@@ -31,6 +31,7 @@
__BEGIN_DECLS
#define HUGE_VAL 1e10000
+#define NAN __builtin_nan("")
#define M_E 2.718281828459045
#define M_PI 3.141592653589793
#define M_PI_2 (M_PI / 2)