Praveen said:
Hi..All,
A quick question.
why is Float.MIN_VALUE < Integer.MIN_VALUE return false? Eventhough both
are 32 bits.
The terms are actually quite misleading as
they describe two different properties.
Integer.MIN_VALUE is a huge negative number,
while Float.MIN_VALUE is the smallest possible
positive one.
And it is a common source of error. In search
algorithms where looking for smallest and largest
number in a collection, I often initialize as
follows:
double minValue = Double.MAX_VALUE;
double maxValue = Double.MIN_VALUE;
The correct approach is of course:
double minValue = +Double.MAX_VALUE;
double maxValue = -Double.MAX_VALUE;