c# - Comparing NaN and null returns illogic value -
why following code snippet returns 1:
double = double.nan; double? i2 = null; i.compareto(i2); from point of view makes no sense. exception more appropriate.
what think reasoning behind decision.
from documentation on compareto:
the value parameter must null or instance of double; otherwise, exception thrown. instance of double, regardless of value, considered greater null.
the value parameter in example null. nan therefore considered greater null why compareto correctly returns 1.
Comments
Post a Comment