diff --git a/nostarch/chapter03.md b/nostarch/chapter03.md index 02977a3b0..9503bc374 100644 --- a/nostarch/chapter03.md +++ b/nostarch/chapter03.md @@ -319,7 +319,7 @@ outside the scope of this text). Each signed variant can store numbers from -(2n - 1) to 2n - 1 - 1 inclusive, where `n` is the number of bits that variant uses. So an -`i8` can store from -(27) to 27, which equals -128 +`i8` can store 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 from 0 to 28 - 1, which equals 0 to 255. diff --git a/src/ch03-02-data-types.md b/src/ch03-02-data-types.md index e7fb48d9f..1bbe31c0c 100644 --- a/src/ch03-02-data-types.md +++ b/src/ch03-02-data-types.md @@ -71,7 +71,7 @@ outside the scope of this text). Each signed variant can store numbers from -(2n - 1) to 2n - 1 - 1 inclusive, where `n` is the number of bits that variant uses. So an -`i8` can store from -(27) to 27, which equals -128 +`i8` can store 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 from 0 to 28 - 1, which equals 0 to 255.