From 03c3530d86392a202694173231d35d444feb9801 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 29 Mar 2020 16:09:03 +0100 Subject: [PATCH] LibJS: Add constant properties to MathObject --- Libraries/LibJS/Runtime/MathObject.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 #include #include +#include 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()