Why does Math.round() return 0 for NaN arguments?
floating-point, java, nan
Solution
Haha. I want to smack myself in the head.
`Math.round(double)` returns a long and a long cannot be `NaN`. The alternative is an exception.
In C# the result is still a `double`.
Problem
I thought that result of any mathematical operation on a NaN should give me a NaN back, but `Math.round(Float.NaN) == 0` What is the rationale for such behavior of Math.round()? Curiously, C# behaves differently: http://msdn.microsoft.com/en-us/library/75ks3aby.aspx