Skip to content

Commit 9f4d296

Browse files
lesleyrsISSOtm
andauthored
Fix binary number examples (#29)
"There are two hard things in programming:" (and counting a long string of zeros is not one of them, but close enough.) Co-authored-by: Eldred Habert <eldredhabert0@gmail.com>
1 parent 4b74ee7 commit 9f4d296

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/part1/bin_and_hex.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Thus, we can generalize the principle outlined above, and write these two number
4646
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
4747
```
4848

49-
So, by applying the same principle, we can say that in base 2, 42 is written as `101010`, and 2048 as `1000000000`.
49+
So, by applying the same principle, we can say that in base 2, 42 is written as `101010`, and 1024 as `10000000000`.
5050
Since you can't tell ten (decimal 10) and two (binary 10) apart, RGBDS assembly has binary numbers prefixed by a percent sign: 10 is ten, and %10 is two.
5151

5252
Okay, but why base 2 specifically?
@@ -59,8 +59,8 @@ Computers thus primarily manipulate binary numbers, and this has a *slew* of imp
5959

6060
To recap, decimal isn't practical for a computer to work with, instead relying on binary (base 2) numbers.
6161
Okay, but binary is really impractical to work with.
62-
Take %10000000000, aka 2048; when in decimal only 4 digits are required, binary instead needs 10!
63-
And, did you notice that I actually wrote one zero too many?
62+
Take %10000000000, aka 2048; when in decimal only 4 digits are required, binary instead needs 12!
63+
And, did you notice that I actually wrote one zero too few?
6464
Fortunately, hexadecimal is here to save the day! 🦸
6565

6666
Base 16 works just the same as every other base, but with 16 digits, called *nibbles*: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.

0 commit comments

Comments
 (0)