mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibJS: Implement exponentiation (** operator)
This commit is contained in:
committed by
Andreas Kling
parent
eafd3dbaf8
commit
0403845d3e
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user