Skip to content

Commit

Permalink
LibJS: Cast to i64 for is_integral_number
Browse files Browse the repository at this point in the history
This fixes the built-ins/Number/isInteger/integers.js test.
9007199254740991 is still an integer, though not a safe one.
  • Loading branch information
sin-ack authored and linusg committed Jun 17, 2021
1 parent a85a95f commit 10f5616
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Userland/Libraries/LibJS/Runtime/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Value {
bool is_negative_infinity() const { return is_number() && __builtin_isinf_sign(as_double()) < 0; }
bool is_positive_zero() const { return is_number() && bit_cast<u64>(as_double()) == 0; }
bool is_negative_zero() const { return is_number() && bit_cast<u64>(as_double()) == NEGATIVE_ZERO_BITS; }
bool is_integral_number() const { return is_finite_number() && (i32)as_double() == as_double(); }
bool is_integral_number() const { return is_finite_number() && static_cast<i64>(as_double()) == as_double(); }
bool is_finite_number() const
{
if (!is_number())
Expand Down

0 comments on commit 10f5616

Please sign in to comment.