Hi Vanitha, I'm not 100% sure but I think it's because '-0' is an <code>int</code>. '0' is just zero to an integer type, + and - don't come into play. The value '0' would be promoted to <code>float</code> and the '-' sign is lost. When you write '-0.0f' you are telling the JVM this is 'float'; and negative or positive zero is meaningful in floating point operations. Hope that helps. ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform
Hi Jane, Thanks for your reply. You are right. I tried this, int integer = -0; float floa = (float)(integer); System.out.println("The value of integer is " + integer + "the value of float is " + floa); //prints The value of integer is 0the value of float is 0.0 Now i got the point, Vanitha.
Regarding to Infinity & -Infinity . I think relative Precedence of - (Unary) & / (Binary) will clear doubt about this Que. When compiler will reaches to exp. 5.0f / -0; , It will consider �0 first and as There is no such -0 integral litral it will take it as 0.And then widening conversion will takes place. i.e. 1) -0 ---> 0 2) 5.0f /0 3) 5.0f /0.0 will give + infinity. Am I right ? Ple tell me . I m keen for reply. Ketan Patel
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad: