Hi, Float f1 = new Float("4.4e99f"); Float f2 = new Float("-4.4e99f"); Double d1 = new Double("4.4e99"); System.out.println(f1); System.out.println(f2); System.out.println(d1); will print out Infinity -Infinity 4.4E99 but on what basis can you decide this? is it the range of primitive float and double ? can someone explain please? Thanks in advance.
Hi, Run this code. Float f1 = new Float(Float.MAX_VALUE); Float f2 = new Float(Float.MIN_VALUE);
System.out.println(f1+" "+f2); Any number above Float.MAX_VALUE will give you positive Infinity. Any number below Float.MIN_VALUE will give you negative Infinity. This is what happening in your code. Similarly you check for Double.MAX_VALUE Double.MIN_VALUE You are right, it is decided by the range. The Float range is Float.MIN_VALUE to Float.MAX_VALUE The Double range is Double.MIN_VALUE to Double.MAX_VALUE
[This message has been edited by P SOLAIAPPAN (edited October 26, 2000).] [This message has been edited by P SOLAIAPPAN (edited October 26, 2000).]