Integers, bits, bytes, and bools
Integers, bits, bytes, bools, and floating point numbers are used in arithmetic operations. Built-in representations of them are called as numeric primitives, and numeric literals are their representations as values in code.
Let’s understand Julia’s primitive numeric types. The following is a table of Integer types, which includes bits, bytes, and bool:
Type | Number of bits | Smallest value | Largest value |
| 8 | -2^7 | 2^7 - 1 |
| 8 | 0 | 2^8 - 1 |
| 16 | -2^15 | 2^15 - 1 |
| 16 | 0 | 2^16 - 1 |
| 32 | -2^31 | 2^31 - 1 |
| 32 | 0 | 2^32 - 1 |
| 64 | -2^63 | 2^63 - 1 |
| 64 | 0 | 2^64 - 1 |
| 128 | -2^127 | 2^127 - 1 |
| 128 | 0 | 2^128 - 1 |
| 8 | false (0) | true (1) |
Â
The UInt
type refers to unsigned integers. These are those integers whose values start from 0.
This table shows the smallest and the largest values that a particular type of integer can hold.
We can also find the smallest and the largest value of a type of integer using the typemin()
and typemax()
function:
julia> typemax(Int32) 2147483647 julia> typemin(Int32...