What are Double.NaN/Float.NaN (Not-a-Number) and when would I need to use it?

John Mitchell

NaN is a special value that represents the case where the result of certain operations doesn't have an actual answer such as dividing zero by zero. So, you would use NaN wherever you might need to know that the result of an operation produced a NaN.

For more information, check out section 4.2.3 of The Java Language Specification.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact