Firstly sun did the right thing with their naming. The constants defined in Float and Double do just fine because its possible to calculat ethe complement of Double.MAX_VALUE by simply adding a minus sign. Having a constant available to get the smallest positive number makes absolute sense - im pretty sure that constant is used by many other classes (eg BigDecimal) when converting to and from a Double and so on. On the other hand Integer.MIN_VALUE and Integer.MAX_VALUE are necessary asits not possible to calculate Integer.MIN_VALUE from Integer.MAX_VALUE in a simple way as we all now the range of negative numbers in 2 complement binary numbers is one more than positive values.
There is a need for smallest Double.MIN_VALUE being positive because there is are gaps in the range of values that can be expressed by a Double. | -Double.NEGATIVE_INFINITY | ? | - Double.MAX_VALUE | ... | -Double.MIN_VALUE | < a > | -0.0 | +0.0 | <b> | +Double.MIN_VALUE | ... | +Double.MAX_VALUE | ? | +Double>POSITIVE.INFINITY | It makes perfect sense to have Double.MIN_VALUE so one can determine the boundaries of what numbers can be represented by a Double at <a> and <b> in the above nasty range. Also calling the constant FRACTION or some derivative would be wrong as that is not the official term - http://en.wikipedia.org/wiki/Floating_point. On Mon, Oct 18, 2010 at 10:45 PM, Casper Bang <casper.b...@gmail.com> wrote: > Dah, should have said -Double.MAX_VALUE (possibly -Double.MAX_VALUE+1, > not sure). > > On Oct 18, 1:19 pm, Casper Bang <casper.b...@gmail.com> wrote: > > > If the smallest double value held -Double.MAX_VALUE what would the > constant > > > holding the smallest possible double value would be called - > > > Double.POSITIVE_SMALLEST_VALUE ? > > > > Frankly I have no need for such constant, what I often DO need to > > know, is the lowest value I can represent within the type. Most would > > expect the concept of "min" and "max" to be independent of internal > > representation of sign, fraction and exponent. An implementation of > > Comparable<Temperature> should revolve around less-than, equals and > > greater-than; assuming Double.MIN_VALUE would be well below absolute > > zero (a mere -273.15 celcius). > > Since Double has MIN_EXPONENT and MAX_EXPONENT, it would make sense if > > the current MIN_VALUE and MAX_VALUE had been named MIN_FRACTION and > > MAX_FRACTION instead. In Java and JavaScript, in order to get the > > minimum non-infinite value, you thus have to use -Double.MIN_VALUE > > (possibly -Double.MIN_VALUE+1, not sure). > > > > > Do you suggest that Double.MAX_VALUE hold > > > infinity ? > > > > Nope, there's already a Double.POSITIVE_INFINITY - there's a > > difference between infinity and the largest number you can represent. > > By definition, the former will always be greater than the latter. > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to javapo...@googlegroups.com. > To unsubscribe from this group, send email to > javaposse+unsubscr...@googlegroups.com<javaposse%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > -- mP -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javapo...@googlegroups.com. To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.