sagar shrivastava wrote:I am facing a problem while studying. In many books the floating point type range in java is given from negative to positive numbers but in son references it is only positive values.
Yeah. This seems to be a common mistake made by books...
With the Double class, are two defined constants...
MIN_VALUE = 4.9e-324
MAX_VALUE = 1.7976931348623157e+308
and for some reason, some books think that the range is from MIN_VALUE to MAX_VALUE.
In fact, the two values have very specific meanings. The MIN_VALUE represents the smallest positive value -- this is as close as you can get to zero, from the positive side, without actually being zero. The MAX_VALUE represents the largest positive value -- this is as close as you can get to infinity, without actually being infinity.
Anyway, I believe the first book is correct, as the range (if you don't count negative and positive infinity, which arguably, aren't really numbers ...
) should be from negative MAX_VALUE to positive MAX_VALUE.
Henry