﻿# V6038\. Comparison with 'double\.NaN' is meaningless\. Use 'double\.isNaN\(\)' method instead\.

The analyzer detected that a variable of type float or double is compared with a Float\.NaN or Double\.NaN value\. As stated in the documentation \(15\.21\.1\), if two Double\.NaN values are tested for equality by using the '\=\=' operator, the result is false\. So, no matter what value of 'double' type is compared with Double\.NaN, the result is always false\.

Consider the following example:

```cpp
void Func(double d) {
  if (d == Double.NaN) {
    ....
  }
}
```

It's incorrect to test the value for NaN using operators '\=\=' and '\!\= '\. Instead, method Float\.isNaN\(\) or Double\.isNaN\(\) should be used\. The fixed version of the code:

```cpp
void Func(double d) {
  if (Double.isNaN(d)) {
    ....
  }
}
```