THE FULL ADDER three bits in — two operands and a carry — sum and carry out
Chain adders and each one must accept the carry from below. The full adder takes three bits — two operand bits and a carry-in — and produces a sum and a carry-out: sum = a ⊕ b ⊕ cin, and cout = (a & b) | (cin & (a ⊕ b)) — carry out when at least two of the three are set. It is the true cell of arithmetic: string n full adders together, feed each one's carry-out into the next one's carry-in, and you can add any two n-bit numbers. The carry is the wire between them.
THE TECHNIQUE sum = a ⊕ b ⊕ cin ; cout = majority(a,b,cin)
The demo adds three bits — two operands plus a carry-in — the sum is the parity, the carry-out the majority: live demo
HISTORY & CREDIT the full adder · the arithmetic cell
“Adders just add two numbers.” — each cell adds three bits, because the carry from below is an input too; the carry-out is the majority vote. cited
three in, two out · sum = parity of the three; carry = majority of the three. the cell · n full adders in a row = an n-bit adder; each carry-out feeds the next carry-in. built from · two half adders (dart 374) plus an OR.
Two operands and a carry, summed to a bit and a carry — the cell that, chained, adds anything. The carry is the link. the full adder
RECOMMEND FOR I-13 the majority carry, on the compiler
On the canonical compiler, 1+1+1 gives sum 1 (parity) and carry-out 1 (majority):
$ i13 run c_fulladder.i13 # sum=a^b^cin, cout=(a&b)|(cin&(a^b))
RUN OK · 22 step(s) · peak stack 4 · call depth 0
sum = 1 -- parity of the three
cout = 1 -- majority of the three
Recommend: the full adder is arithmetic's true cell — three bits in, the sum a parity, the carry a majority — and i13 confirms 1+1+1. Not a keeper (the arithmetic cell is correctness). The dart that makes the carry a wire: chain these and the carry-out of each becomes the carry-in of the next — which is the ripple (dart 376).