posted 21 years ago
Hi
I have one problem in understanding the o/p of the following statements:
1. System.out.println(Math.min(-0.0,+0.0));
2. System.out.println(Math.max(-0.0,+0.0));
3. System.out.println(Math.min(-0.0,+0.0) == Math.max(0.0,+0.0));
o/p is: -0.0
0.0
true
First two o/p are quite clear but I have problem with the third one why it's giving true? According to my understanding it should give false as Math.min(-0.0,+0.0)) is -0.0 and Math.max(-0.0,+0.0)) is 0.0 so when compare both it's not equal so false.
Can anyone explain this to me?
Thanks in advance.
Suman