Forums Register Login

NaN

+Pie Number of slices to send: Send
I just got the RHE Java2 Certification study guide.
I was surprised to see that a double divided by 0 is equal to Double.NEGATIVE_INFINITY. All other books I had read said that a double divided by 0 was equal to Double.NaN.
Now I am curious. What sort of operation would result in Double.NaN?
+Pie Number of slices to send: Send
Hi,
Try
System.out.println(Math.sqrt(-1.0));
Note that it does not throw any exception.
+Pie Number of slices to send: Send
Thanks Cata Lin.
That makes a lot of sense.
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 541 times.
Similar Threads
pls help on NaN
Double Equals
Double.NaN
Double.NaN comparison using equals method
NaN and .equals()
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:44:04.