Is -Double.MAX_VALUE guaranteed to give the smalle...
# announcements
m
Is -Double.MAX_VALUE guaranteed to give the smallest finite negative Double?
👌 1
a
it should be guaranteed, is it not?
s
i haven't checked up my Double representation know-how in a while, but for Byte it wouldn't be the same. There the range is -128 to 127.
Copy code
fun main() {
    println(Double.MAX_VALUE)
    println(Double.MIN_VALUE)
    println(Double.MIN_VALUE==-Double.MAX_VALUE)
}
leads to
Copy code
1.7976931348623157E308
4.9E-324
false
h
Double.MIN_VALUE is not the most negative, but the closest to zero.
s
that explains why the value for Double.MIN_VALUE wasn't negative 😅 But I have to admit that I was surprised by this.
h
yeah, the naming is not consistent with the integer classes 🙂 (but it makes sense, since these are the limits of representability)
s
Indeed, Int.MIN_VALUE isn't
1
😂
but basically nobody of us has answered the original question. Mitch never asked about Double.MIN_VALUE 😅