Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Java, what happens if you use Double.NaN in an operation?

Tags:

java

nan

I have compiled code that erroneously tries to add a number and Double.NaN. I'm wondering if it's throwing an exception that's not getting caught? Does anyone know how that situation is handled?
Thanks.

like image 237
user45728 Avatar asked Dec 12 '08 14:12

user45728


1 Answers

Adding a number to NaN gives NaN. It isn't expected to cause an exception. I understand that this conforms to IEEE 754.

like image 80
Adrian Avatar answered Nov 12 '22 17:11

Adrian