All rules
CA2242Usage Enabled by default: As suggestion
Test for NaN correctly
Test for NaN correctly
Microsoft docsDescription
System.Double.NaN, which represents a value that's not a number, results when an arithmetic operation is undefined. Any expression that tests for equality between a value and System.Double.NaN always returns false. Any expression that tests for inequality (!= in C#) between a value and System.Double.NaN always returns true.
Cause
An expression tests a value against System.Single.NaN or System.Double.NaN.
How to fix violations
To fix a violation of this rule and accurately determine whether a value represents System.Double.NaN, use System.Single.IsNaN or System.Double.IsNaN to test the value.
When to suppress
Do not suppress a warning from this rule.
Your vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0