Numeric Data Types
Let’s learn about numeric data types.
Go supports integer, floating-point, and complex number values in various versions depending on the memory space they consume—this saves memory and computing time. Integer data types can be either signed or unsigned, which is not the case for floating-point numbers.
List of numeric data types
The table that follows lists the numeric data types of Go.
Data Type | Description |
| 8-bit signed integer |
| 16-bit signed integer |
| 32-bit signed integer |
| 64-bit signed integer |
| 32- or 64-bit signed integer |
| 8-bit unsigned integer |
| 16-bit unsigned integer |
| 32-bit unsigned integer |
| 64-bit unsigned integer |
| 32- or 64-bit unsigned integer |
| 32-bit floating-point number |
| 64-bit floating-point number |
| Complex number with |
| Complex number with |
The int
and uint
data types are special as they are the most efficient sizes for signed and unsigned integers on a given platform and can be either 32 or 64 bits each—their size is defined by Go itself. The int
data type is the most widely used data type in Go due ...