This story was originally published on Medium
Signed Integer Types
The default integer type in Rust is
i32. Signed integer types in Rust start with
i and it has 8, 16, 32, 64, and 128-bit.
The minimum and maximum values are from -(2ⁿ⁻¹) to 2ⁿ⁻¹-1. The
-1 in the
n-1 is the sign bit (positive or negative), which we cover in the next section.
i8 has -(2⁷) to 2⁷-1, which is -128 to 127. The following table shows all the details for signed integers.