mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 14:07:45 +00:00
LibJS: Basic NaN support
This patch adds js_nan() for constructing a NaN value. You can check if a Value is NaN with Value::is_nan().
This commit is contained in:
parent
23c5323a70
commit
9a78b4af2c
3 changed files with 23 additions and 7 deletions
|
@ -53,6 +53,8 @@ public:
|
|||
bool is_cell() const { return is_string() || is_object(); }
|
||||
bool is_array() const;
|
||||
|
||||
bool is_nan() const { return is_number() && __builtin_isnan( as_double()); }
|
||||
|
||||
Value()
|
||||
: m_type(Type::Undefined)
|
||||
{
|
||||
|
@ -166,6 +168,11 @@ inline Value js_null()
|
|||
return Value(Value::Type::Null);
|
||||
}
|
||||
|
||||
inline Value js_nan()
|
||||
{
|
||||
return Value(__builtin_nan(""));
|
||||
}
|
||||
|
||||
Value greater_than(Value lhs, Value rhs);
|
||||
Value greater_than_equals(Value lhs, Value rhs);
|
||||
Value less_than(Value lhs, Value rhs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue