Double.NaN == myDouble
This happens because Java's implementation of NaN follows IEEE 754 which I understand specifies this behaviour.
I also had many headaches with NaN values. Many algorithms do not cope well with it, or the handling was added as an afterthought. There are a few entries about NaN in my blog:http://www.jroller.com/ethdsy/entry/nan_of_themhttp://www.jroller.com/ethdsy/entry/looking_for_maxhttp://www.jroller.com/ethdsy/entry/java_io_does_not_save
many thanks for the post
You should use Double.compare or Double.compareTo for this, works like a charm!