The Go programming language has various types to represent numbers. Alongside numerous int types, such as `int8`

and `uint32`

, there’s also the fairly standard `float`

. The Go programming language didn’t stop there though, no, instead it takes it one step further to even include a `complex64`

and `complex128`

type which allows you to represent imaginary numbers.

In this post, we’ll take a look at the size ranges for the various numerical types in Go. Go supports both signed and unsigned integers and it’s values are consistent with other programming languages.

## Go `int`

Range

The `int`

type is one of the more flexible numerical types in Go. Its range is dependent on the underlying architecture of the system it is compiled for.

If the target architecture is 32-bit, then the range is between **-2,147,483,648** and **2,147,483,647**.

If the target architecture is 64-bit, then the range is between **-9,223,372,036,854,775,808** and **9,223,372,036,854,775,807**.

When you assign a numerical value to a variable, the `int`

type is the default type assigned, unless you explicitly specify a different type.

## Go `int8`

Range

The `int8`

type represents all 8-bit signed integers.

The range for the `int8`

type is between **-128** and **127**.

## Go `int16`

Range

The `int16`

type represents all 16-bit signed integers.

Thus, the range for the `int16`

type in Go is between **-32,768** and **32,767**.

## Go `int32`

Range

The `int32`

type represents all 32-bit signed integers.

Much like the default `int`

variable for 32-bit systems, the range of values you can represent for this type is between **-2,147,483,648** and **2,147,483,647**.

## Go `int64`

Range

The `int64`

type represents all 64-bit signed integers.

Again, similar to the default `int`

variable for 32-bit systems, the ranges you can represent is between **-9,223,372,036,854,775,808** and **9,223,372,036,854,775,807**.

## Go `uint`

Range

Much like `int`

, the `uint`

type has a range that is dependent on the underlying architecture of the system that will run the code.

If the target architecture is 32-bit, then the range is between **0** and **4,294,967,295**.

If the target architecture is 64-bit, then the range is between **-9,223,372,036,854,775,808** and **18,446,744,073,709,551,615**.

## Go `uint8`

Range

The `uint8`

type represents all 8-bit unsigned integers.

The range for the `uint8`

type is between **0** and **255**.

## Go `uint16`

Range

The `uint16`

type represents all 16-bit unsigned integers.

Thus, the range for the `uint16`

type in Go is between **0** and **65535**.

## Go `int32`

Range

The `uint32`

type represents all 32-bit unsigned integers.

Like the `uint`

variable for 32-bit systems, the range of values you can represent for this type is between **0** and **4,294,967,295**.

## Go `int64`

Range

The `uint64`

type represents all 64-bit unsigned integers.

Similar to the default `uint`

variable for 32-bit systems, the ranges you can represent is between **0** and **18,446,744,073,709,551,615**.

## Go `float32`

Range

The `float32`

type goes above and beyond what `int64`

could hold, not just in whole numbers, but also decimals. It goes without saying that if you are using `float32`

, the rounding algorithm will use 32-bit precision.

The range of values for `float32`

in Go are between **1.401298464324817070923729583289916131280e-45** and **3.40282346638528859811704183484516925440e+38**.

## Go `float64`

Range

The `float64`

type goes even further. If you use `float64`

, your decimal values will use 64-bit precision.

The range of values for `float64`

in Go are between **4.940656458412465441765687928682213723651e-324** and **1.797693134862315708145274237317043567981e+308**.

## Go `complex64`

Range

The `complex64`

type in Go represents the set of all complex numbers in `float32`

’s range, including all real and imaginary parts.

## Go `complex128`

Range

Finally, the `complex128`

type in Go represents the set of all complex numbers in `float64`

’s range, including all real and imaginary parts.