diff options
author | Linus Groh <mail@linusgroh.de> | 2020-03-29 16:09:03 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-29 17:35:08 +0200 |
commit | 03c3530d86392a202694173231d35d444feb9801 (patch) | |
tree | 55cca09649b52f30087aca6f3056189018182c32 | |
parent | c698cc899d64f521b158babd9fee9b83475ac472 (diff) | |
download | serenity-03c3530d86392a202694173231d35d444feb9801.zip |
LibJS: Add constant properties to MathObject
-rw-r--r-- | Libraries/LibJS/Runtime/MathObject.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/MathObject.cpp b/Libraries/LibJS/Runtime/MathObject.cpp index 8f9de1911f..611a556a6c 100644 --- a/Libraries/LibJS/Runtime/MathObject.cpp +++ b/Libraries/LibJS/Runtime/MathObject.cpp @@ -28,6 +28,7 @@ #include <AK/Function.h> #include <LibJS/Interpreter.h> #include <LibJS/Runtime/MathObject.h> +#include <LibM/math.h> namespace JS { @@ -35,6 +36,15 @@ MathObject::MathObject() { put_native_function("abs", abs); put_native_function("random", random); + + put("E", Value(M_E)); + put("LN2", Value(M_LN2)); + put("LN10", Value(M_LN10)); + put("LOG2E", Value(log2(M_E))); + put("LOG10E", Value(log10(M_E))); + put("PI", Value(M_PI)); + put("SQRT1_2", Value(sqrt(1 / 2))); + put("SQRT2", Value(sqrt(2))); } MathObject::~MathObject() |