mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:37:35 +00:00
LibJS: Implement Object.is()
Basically === with two particularities: comparing NaN to itself is considered equal and comparing +0 and -0 is not.
This commit is contained in:
parent
f191b84b50
commit
38ba13e912
4 changed files with 73 additions and 0 deletions
|
@ -57,6 +57,8 @@ public:
|
|||
|
||||
bool is_nan() const { return is_number() && __builtin_isnan(as_double()); }
|
||||
bool is_infinity() const { return is_number() && __builtin_isinf(as_double()); }
|
||||
bool is_positive_zero() const { return is_number() && 1.0 / as_double() == __builtin_huge_val(); }
|
||||
bool is_negative_zero() const { return is_number() && 1.0 / as_double() == -__builtin_huge_val(); }
|
||||
bool is_finite_number() const
|
||||
{
|
||||
if (!is_number())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue