public class MA { public static void main(String ags[]){ if ((0.0/0.0)==Double.NaN) System.out.print (0.0/0.0); System.out.print ("not equal"); } } can anyone tell me why output is not equal rather than NaN? ready
Originally posted by ready: public class MA { public static void main(String ags[]){ if ((0.0/0.0)==Double.NaN) System.out.print (0.0/0.0); System.out.print ("not equal"); } } can anyone tell me why output is not equal rather than NaN? ready
I remember reading this in RHE. Even (Double.NaN == Double.NaN) returns false. It is just the nature of NaN - it is not a finite quality that can be used for comparison. Savithri