Is Mistake in documentation?

In documentaion of kotlin has mistake. Concepts>Types>Basic types>Numbers. There is an error in the table where the minimum and maximum sizes of types are indicated. The minimum size of a long type is -9_223_372_036_854_775_807 rather than -9_223_372_036_854_775_808.

Using the JVM documentation:

A constant holding the minimum value a long can have, -2^63

-2^63 = -9_223_372_036_854_775_808

In the Kotlin builtins:

public class Long private constructor() : Number(), Comparable<Long> {
    companion object {
         * A constant holding the minimum value an instance of Long can have.
        public const val MIN_VALUE: Long = -9223372036854775807L - 1L

It is written in this way because of some weirdness around - being an operator that applies to a literal value and not part of the definition of a literal value itself, but regardless it still results in the same number: -9_223_372_036_854_775_808.
In fact, one can verify this simply by making Kotlin print out the answer!

fun main() {
1 Like

Oh thanks, I got it, the minimum constant where Long doesn’t break is -9223372036854775807L - 1L, after (if 2^63L - 2L) there will be a positive number 9223372036854775807