You should use the float and double static methods for checking for NaN values (E.g. float.isNaN), rather than using the equality operator. The equality operator will not work to compare a value against double.NaN and float.NaN.
1
2
3
4
5
6
7
8
| // Easiest way--use static methodbool b1 = double.IsNaN(0.0 / 0.0); // true// == operator doesn't workbool b2 = (0.0 / 0.0) == double.NaN; // false !// object.Equals does workbool b3 = object.Equals(0.0 / 0.0, double.NaN); |

