Skip to content

nan-comparison

Default severity: error

IEEE floating-point NaN is unequal to every value, including itself, and all ordered comparisons with it are false. Use math.IsNaN when testing whether a value is NaN.

if value == math.NaN() { handle() }
if math.IsNaN(value) { handle() }