staticcheck/sa4012/testdata/go1.0/CheckNaNComparison/CheckNaNComparison.go
raw| 1 | package pkg |
| 2 | |
| 3 | import "math" |
| 4 | |
| 5 | func fn(f float64) { |
| 6 | _ = f == math.NaN() //@ diag(`no value is equal to NaN`) |
| 7 | _ = f > math.NaN() //@ diag(`no value is equal to NaN`) |
| 8 | _ = f != math.NaN() //@ diag(`no value is equal to NaN`) |
| 9 | } |
| 10 | |
| 11 | func fn2(f float64) { |
| 12 | x := math.NaN() |
| 13 | if true { |
| 14 | if f == x { //@ diag(`no value is equal to NaN`) |
| 15 | } |
| 16 | } |
| 17 | } |