mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibJS: Add constant properties to MathObject
This commit is contained in:
parent
c698cc899d
commit
03c3530d86
Notes:
sideshowbarker
2024-07-19 08:04:45 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/03c3530d863 Pull-request: https://github.com/SerenityOS/serenity/pull/1529 Reviewed-by: https://github.com/awesomekling
1 changed files with 10 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue