mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 14:47:34 +00:00
LibJS: Add Value::to_double() for convenience
This commit is contained in:
parent
a9779e12ea
commit
2ffa054574
2 changed files with 6 additions and 0 deletions
|
@ -170,6 +170,11 @@ i32 Value::to_i32() const
|
||||||
return static_cast<i32>(to_number().as_double());
|
return static_cast<i32>(to_number().as_double());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double Value::to_double() const
|
||||||
|
{
|
||||||
|
return to_number().as_double();
|
||||||
|
}
|
||||||
|
|
||||||
Value greater_than(Value lhs, Value rhs)
|
Value greater_than(Value lhs, Value rhs)
|
||||||
{
|
{
|
||||||
return Value(lhs.to_number().as_double() > rhs.to_number().as_double());
|
return Value(lhs.to_number().as_double() > rhs.to_number().as_double());
|
||||||
|
|
|
@ -146,6 +146,7 @@ public:
|
||||||
bool to_boolean() const;
|
bool to_boolean() const;
|
||||||
Value to_number() const;
|
Value to_number() const;
|
||||||
i32 to_i32() const;
|
i32 to_i32() const;
|
||||||
|
double to_double() const;
|
||||||
|
|
||||||
Object* to_object(Heap&) const;
|
Object* to_object(Heap&) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue