honnef.co/go/tools@v0.4.7/staticcheck/testdata/src/example.com/CheckNaNComparison/CheckNaNComparison.go (about)

     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  }