Name: dbT83986 Date: 03/09/99
Maybe I'm missing something, but I seem to be getting weird results
with Math.max() and Math.min() when comparing zero with MIN_VALUE
MAX_VALUE. Below is the code, and then the results:
System.out.println(Math.min(0d, Double.MIN_VALUE)); // Wrong
0.0
System.out.println(Math.min(0d, Double.MAX_VALUE));
// 0.0
System.out.println(Math.max(0d, Double.MIN_VALUE)); // Wrong
4.9E-324
System.out.println(Math.max(0d, Double.MAX_VALUE));
// 1.7976931348623157E308
System.out.println(0d > Double.MIN_VALUE)); // Wrong
false
System.out.println(0d > Double.MAX_VALUE);
// false
System.out.println(0d < Double.MIN_VALUE); // Wrong
true
System.out.println(0d < Double.MAX_VALUE);
// true
Results:
0.0
0.0
4.9E-324
1.7976931348623157E308
false
false
true
true
(Review ID: 54459)
======================================================================