In .Net the type Double has a static method IsNan() which accepts one parameter, a double and returns a bool.
Surely, this means that the method will always return true as it can only accept a double? Can someone explain the point of this method and when it might return false? Purely curious and wanting to be educated.
Edit: My apologies for a very poorly asked question. You are all right, I should have read the documentation. And, yes I did mean “the method will always return false”.
doubleandfloathave “Not A Number” values that they use to represent error quantities. A NaN has the unfortunate property that it always compares false to everything, including itself. Thus you call a special method to tell you if a given double is a NaN. (Since NaNs are the only values that have the property that they do not equal themselves, you can also tell if a value is a NaN by comparing it to itself! Butx != xlooks weird in the code; it is much more idiomatic to simply callIsNaN(x).)Is there something about the documentation that was so unclear that it prompted you to ask a question here? If you can explain what you found unclear I can pass that feedback on to the documentation manager.