﻿# V8018\. Comparison with 'math\.NaN\(\)' is meaningless\. Use the 'math\.IsNaN\(\)' function instead\.

The analyzer detected a comparison of a float type variable with math\.NaN\(\)\. Even if the variable has the value math\.NaN\(\), any check of math\.NaN\(\) using comparison operators results incorrectly\.

Look at the example:

```cpp
func Foo(a float64) {
  if a == math.NaN() {
    ....
  }
}
```

Checking the variable for `NaN` using the `==` operator will always return `false`\. Instead, use the [`math.IsNaN`](https://pkg.go.dev/math#IsNaN) function\.

The fixed code snippet:

```cpp
func Foo(a float64) {
  if math.IsNaN(a) {
    ....
  }
}
```