mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:37:35 +00:00
LibM: Add NAN macro
This commit is contained in:
parent
d315281d56
commit
8a94813007
3 changed files with 5 additions and 3 deletions
|
@ -32,6 +32,7 @@
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Runtime/Symbol.h>
|
#include <LibJS/Runtime/Symbol.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
// 2 ** 53 - 1
|
// 2 ** 53 - 1
|
||||||
static constexpr double MAX_ARRAY_LIKE_INDEX = 9007199254740991.0;
|
static constexpr double MAX_ARRAY_LIKE_INDEX = 9007199254740991.0;
|
||||||
|
@ -251,7 +252,7 @@ inline Value js_null()
|
||||||
|
|
||||||
inline Value js_nan()
|
inline Value js_nan()
|
||||||
{
|
{
|
||||||
return Value(__builtin_nan(""));
|
return Value(NAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Value js_infinity()
|
inline Value js_infinity()
|
||||||
|
|
|
@ -211,7 +211,7 @@ double log10(double x)
|
||||||
double log(double x)
|
double log(double x)
|
||||||
{
|
{
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
return __builtin_nan("");
|
return NAN;
|
||||||
if (x == 0)
|
if (x == 0)
|
||||||
return -__builtin_huge_val();
|
return -__builtin_huge_val();
|
||||||
double y = 1 + 2 * (x - 1) / (x + 1);
|
double y = 1 + 2 * (x - 1) / (x + 1);
|
||||||
|
@ -321,7 +321,7 @@ double atan(double x)
|
||||||
double asin(double x)
|
double asin(double x)
|
||||||
{
|
{
|
||||||
if (x > 1 || x < -1)
|
if (x > 1 || x < -1)
|
||||||
return __builtin_nan("");
|
return NAN;
|
||||||
if (x > 0.5 || x < -0.5)
|
if (x > 0.5 || x < -0.5)
|
||||||
return 2 * atan(x / (1 + sqrt(1 - x * x)));
|
return 2 * atan(x / (1 + sqrt(1 - x * x)));
|
||||||
double squared = x * x;
|
double squared = x * x;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define HUGE_VAL 1e10000
|
#define HUGE_VAL 1e10000
|
||||||
|
#define NAN __builtin_nan("")
|
||||||
#define M_E 2.718281828459045
|
#define M_E 2.718281828459045
|
||||||
#define M_PI 3.141592653589793
|
#define M_PI 3.141592653589793
|
||||||
#define M_PI_2 (M_PI / 2)
|
#define M_PI_2 (M_PI / 2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue