mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:57:43 +00:00
LibJS: Implement exponentiation (** operator)
This commit is contained in:
parent
eafd3dbaf8
commit
0403845d3e
7 changed files with 48 additions and 1 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <LibJS/Runtime/PrimitiveString.h>
|
||||
#include <LibJS/Runtime/StringObject.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
@ -268,6 +269,11 @@ Value mod(Value lhs, Value rhs)
|
|||
return Value(index - trunc * period);
|
||||
}
|
||||
|
||||
Value exp(Value lhs, Value rhs)
|
||||
{
|
||||
return Value(pow(lhs.to_number().as_double(), rhs.to_number().as_double()));
|
||||
}
|
||||
|
||||
Value typed_eq(Value lhs, Value rhs)
|
||||
{
|
||||
if (rhs.type() != lhs.type())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue