Hi,
I compiled and run this code. It seems that 100.0/-0 s positive and 100.0/-0.0 is negative. So there is a negative zero for doubles but not for ints?. Is there any explanation for this?
<pre>
public class A1{
public static void main(
String [] buff){
//double d = 100.0/-0.0; // outputs negative infinity
double d = 100.0/-0; // outputs positive infinity
if(d == Double.NEGATIVE_INFINITY){
System.out.println("NEGATIVE_INFINITY");
}else{
System.out.println("POSITIVE_INFINITY");
}
}
}
</pre>
Thank you very much