◄ WORLD V · SONNY 5DART 383 · a helldive at the net

THE BORROW subtraction's carry, running backwards — take from the next column

Subtraction has a carry too, running the other way: the borrow. When a column cannot subtract — 5−8 in one digit — it borrows from the next column up. In hardware there is no separate subtractor: a−b is computed as a + (¬b) + 1 — add the two's complement — and the carry-out of that addition is the borrow, inverted. So the same adder does both: feed it b and it adds, feed it ¬b with a carry-in of 1 and it subtracts. The borrow is the carry, seen from subtraction's side of the mirror.

THE TECHNIQUE a − b = a + (¬b) + 1 ; borrow = the carry, complemented

The demo subtracts 5−8 via two's-complement addition — the borrow is set (5<8): live demo


HISTORY & CREDIT subtraction as complement addition

“A chip needs a subtractor.” — it needs an adder: a−b = a + (¬b) + 1, and the carry-out is the borrow. One circuit, both operations. cited

borrow · a column that cannot subtract takes from the next — the carry of subtraction.
in hardware · a + (¬b) + 1 (add the two's complement); carry-out = NOT borrow.
one adder · the ALU adds or subtracts by choosing b or ¬b and the carry-in.

The column that comes up short takes from the next; in silicon, that is the adder run on a complement. The carry, mirrored. the borrow

RECOMMEND FOR I-13 subtraction by complement, on the compiler

On the canonical compiler, 5−8 via 5+(256−8)=253 (i.e. −3 in a byte) — the borrow is set because 5<8:

$ i13 run c_borrow.i13 # a-b via a + (256-b), 8-bit RUN OK · 22 step(s) · peak stack 3 · call depth 0 diff = -3 borrow = 1 -- 5 < 8 : borrow from the next column result = 253 -- -3 as an unsigned byte (two's complement)
Recommend: the borrow is the carry mirrored — subtraction's take-from-above, realised as the adder run on a complement — and i13 does 5−8 with the borrow set. Not a keeper (subtraction-as-complement-addition rides two's complement, which is a self-inverse trick already, dart's cousin axis; the borrow bit is a recognizer). The dart that shows one adder is a subtractor too — the carry flowing the other way.