mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
LibM: Add NAN macro
This commit is contained in:
parent
d315281d56
commit
8a94813007
Notes:
sideshowbarker
2024-07-19 05:50:39 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/8a94813007e Pull-request: https://github.com/SerenityOS/serenity/pull/2496
3 changed files with 5 additions and 3 deletions
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue