1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

LibJS: Add Math.pow()

This commit is contained in:
Linus Groh 2020-04-23 12:36:08 +01:00 committed by Andreas Kling
parent 687096cadd
commit 97366f4dd4
3 changed files with 36 additions and 0 deletions

View file

@ -48,6 +48,7 @@ MathObject::MathObject()
put_native_function("sin", sin, 1);
put_native_function("cos", cos, 1);
put_native_function("tan", tan, 1);
put_native_function("pow", pow, 2);
put("E", Value(M_E));
put("LN2", Value(M_LN2));
@ -180,4 +181,9 @@ Value MathObject::tan(Interpreter& interpreter)
return Value(::tan(number.as_double()));
}
Value MathObject::pow(Interpreter& interpreter)
{
return exp(interpreter, interpreter.argument(0), interpreter.argument(1));
}
}