Integers and Floating-Point Numbers
Discover numeric types and understand integer and floating-point representations, and their conversions in Kotlin.
Numeric types
In Kotlin, there is a range of different types that are used to represent numbers. They can be divided into:
Representing integer numbers (numbers without decimal points)
Representing floating-point numbers (numbers with decimal points)
In these groups, the difference is in the number of bits used to represent these numbers, which determines the possible number size and precision.
Integer types and their characteristics
To represent integer numbers, we use Int
, Long
, Byte
, and Short
. Their keywords to define their variables, size in bits, and ranges have been summarized below:
Get hands-on with 1200+ tech skills courses.