diff options
author | Linus Groh <mail@linusgroh.de> | 2020-04-07 17:06:26 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-07 21:28:43 +0200 |
commit | b7032b49724dc2d1e7582aec94e8b40ce1bb57c0 (patch) | |
tree | ae0a26dac3ed72033c5ab429d8ee8d0449bbb20b /Libraries/LibJS/Runtime | |
parent | f85aa8462f2893cf6e719f7c17005ec44a1e9705 (diff) | |
download | serenity-b7032b49724dc2d1e7582aec94e8b40ce1bb57c0.zip |
LibJS: Add Number constants
Diffstat (limited to 'Libraries/LibJS/Runtime')
-rw-r--r-- | Libraries/LibJS/Runtime/NumberConstructor.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Libraries/LibJS/Runtime/NumberConstructor.cpp index 924c14a0d4..21b6cc01ee 100644 --- a/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -28,6 +28,7 @@ #include <LibJS/Runtime/Error.h> #include <LibJS/Runtime/NumberConstructor.h> #include <LibJS/Runtime/NumberObject.h> +#include <math.h> namespace JS { @@ -35,6 +36,12 @@ NumberConstructor::NumberConstructor() { put("prototype", interpreter().number_prototype()); put("length", Value(1)); + put("EPSILON", Value(pow(2, -52))); + put("MAX_SAFE_INTEGER", Value(pow(2, 53) - 1)); + put("MIN_SAFE_INTEGER", Value(-(pow(2, 53) - 1))); + put("NEGATIVE_INFINITY", Value(-js_infinity().as_double())); + put("POSITIVE_INFINITY", js_infinity()); + put("NaN", js_nan()); } NumberConstructor::~NumberConstructor() |