Skip to content
Merged
Prev Previous commit
Next Next commit
additional typos and clarifications
  • Loading branch information
justinmeiners committed Dec 15, 2021
commit d7308063fd723e2c852a62a8e13231545c21d476
11 changes: 6 additions & 5 deletions 10_binary_counter.html
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,12 @@ <h2>Binary counting and reduction</h2>
<p>What if the index <code>1</code> slot was non-zero, after comparing <code>x</code> and <code>y</code>?
Then the guy there already won one game.
So, we must <strong>carry propogate</strong><sup id="fnref:10"><a href="#fn:10" rel="footnote">10</a></sup>.
Repeat the same process all the way up the counter, until we find a slot which is zero.</p>
Repeat the same process all the way up the counter, until we find a slot which is zero.
What if the counter is full, and has no zero slots?
That&rsquo;s called an <strong>overflow</strong>.</p>

<p>What if the counter is full, and has no zero slots?
That&rsquo;s called an an <strong>overflow</strong>.
There is a close analogy between our counter and binary integer counting:</p>
<p>We borrow terminology from binary integer arithemtic because
our counter works just like a binary integer counting up:</p>

<pre><code>0 0 0
1 0 0
Expand Down Expand Up @@ -569,7 +570,7 @@ <h3>Counter storage</h3>
whenever you sum up large number you don&rsquo;t really want to
add small quantities to big quantities.
Bad things happen to the errors<sup id="fnref:12"><a href="#fn:12" rel="footnote">12</a></sup>.
Use this code to write a sum function for arrays of <code>double</code>.</p>
Use this code to write a function which sums arrays of <code>double</code>.</p>

<p><strong>Exercise:</strong> Rewrite <code>min_element</code> using this code (just <code>min_element</code>, don&rsquo;t worry about second best).</p>

Expand Down
9 changes: 5 additions & 4 deletions 10_binary_counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,11 @@ What if the index `1` slot was non-zero, after comparing `x` and `y`?
Then the guy there already won one game.
So, we must **carry propogate**[^adder-circuit].
Repeat the same process all the way up the counter, until we find a slot which is zero.

What if the counter is full, and has no zero slots?
That's called an an **overflow**.
There is a close analogy between our counter and binary integer counting:
That's called an **overflow**.

We borrow terminology from binary integer arithemtic because
our counter works just like a binary integer counting up:

0 0 0
1 0 0
Expand Down Expand Up @@ -566,7 +567,7 @@ We could compete with Steve Jobs for elegance of our design[^alex-apple-joke].
whenever you sum up large number you don't really want to
add small quantities to big quantities.
Bad things happen to the errors[^errors].
Use this code to write a sum function for arrays of `double`.
Use this code to write a function which sums arrays of `double`.

**Exercise:** Rewrite `min_element` using this code (just `min_element`, don't worry about second best).

Expand Down