menu
no-negated-float-comparison
Disallow negated floating-point ordering comparisons that accept NaN
!(left < right) evaluates to true when either operand is NaN because every ordering comparison with NaN evaluates to false.
Instead, you SHOULD handle NaN explicitly and write the intended positive comparison, such as !left.isNaN() && !right.isNaN() && left >= right.
Reported
1function isAtLeast(left: float64, right: float64): boolean {2 return !(left < right);3}Accepted
1function isAtLeast(left: float64, right: float64): boolean {2 return !left.isNaN() && !right.isNaN() && left >= right;3}