mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 19:24:32 -06:00
@@ -325,10 +325,10 @@ Signed numbers are stored using two’s complement representation (if you’re
|
||||
unsure what this is, you can search for it online; an explanation is outside
|
||||
the scope of this book).
|
||||
|
||||
Each signed variant can store numbers from -(2n - 1) to 2n - 1 - 1 inclusive,
|
||||
Each signed variant can store numbers from -2<sup>n - 1</sup> to 2<sup>n - 1</sup> - 1 inclusive,
|
||||
where `n` is the number of bits that variant uses. So an `i8` can store numbers
|
||||
from -(27) to 27 - 1, which equals -128 to 127. Unsigned variants can store
|
||||
numbers from 0 to 2n - 1, so a `u8` can store numbers from 0 to 28 - 1, which
|
||||
from -2<sup>7</sup> to 2<sup>7</sup> - 1, which equals -128 to 127. Unsigned variants can store
|
||||
numbers from 0 to 2<sup>n</sup> - 1, so a `u8` can store numbers from 0 to 2<sup>8</sup> - 1, which
|
||||
equals 0 to 255.
|
||||
|
||||
Additionally, the `isize` and `usize` types depend on the kind of computer your
|
||||
|
||||
Reference in New Issue
Block a user