mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:47:45 +00: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()))
|
: (x.as_double() > y.as_double()))
|
||||||
return 1;
|
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𝔽.
|
// 9. If x is +0𝔽 and y is -0𝔽, return 1𝔽.
|
||||||
if (x.is_positive_zero() && y.is_negative_zero())
|
if (x.is_positive_zero() && y.is_negative_zero())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue