mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +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
Notes:
sideshowbarker
2024-07-19 07:17:14 +09:00
Author: https://github.com/linusg
Commit: 38ba13e912
Pull-request: https://github.com/SerenityOS/serenity/pull/1959
Reviewed-by: https://github.com/awesomekling
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