mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-25 19:02:07 -05:00
LibJS: Add missing spec step to CompareTypedArrayElements
This isn't actually much of an issue because if the LHS side value is -0 and the RHS value is +0, errantly returning 0 in the comparison function here has the same effect as correctly returning -1. In both cases, the -0 is left on the LHS.
This commit is contained in:
parent
864221cb02
commit
56db4235df
1 changed files with 4 additions and 0 deletions
|
@ -412,6 +412,10 @@ ThrowCompletionOr<double> compare_typed_array_elements(GlobalObject& global_obje
|
|||
: (x.as_double() > y.as_double()))
|
||||
return 1;
|
||||
|
||||
// 8. If x is -0𝔽 and y is +0𝔽, return -1𝔽.
|
||||
if (x.is_negative_zero() && y.is_positive_zero())
|
||||
return -1;
|
||||
|
||||
// 9. If x is +0𝔽 and y is -0𝔽, return 1𝔽.
|
||||
if (x.is_positive_zero() && y.is_negative_zero())
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue