Blog
[the widgets run in the browser; the TRI-27 modules follow the pinned emulator, the rest teaches with small numbers] Course 8 on t27.ai: 27 lessons from why base 3 is cheapest (39 against 40 for every number up to 999999) through balanced ternary, Kleene logic, adders, multiplying without a multiplier, five trits in a byte, the TRI-27 instruction word and a ternary machine, to neurons with weights -1, 0, +1.

t27.ai has a new course, the eighth: The ternary machine. It starts from why base 3 at all and ends with neurons whose weights are -1, 0 and +1, in 27 lessons of 9 modules. Each lesson opens a widget to press, and every number a widget shows is computed by a t27 spec compiled to WebAssembly in your browser, not written into the page.
Price a digit by how many states it must tell apart, and a number costs base times digits. The first widget runs radix_economy.t27: every number up to 999999 costs 39 in base 3 and 40 in bases 2 and 4, because b / ln b is smallest at e and 3 is the nearest whole base. The lesson also says what that model omits: binary won because two-state parts are cheap, fast and robust.
With digits -1, 0 and +1 a number needs no sign, negation flips every trit, and cutting trits is already rounding. Adding is a full adder per place; the figure below is the ripple-carry widget's opening case, drawn from the same compiled trits.t27 the widget runs.
Multiplying by a trit is a switch: copy, drop or flip. That is the reason ternary neural networks are cheap in hardware, and the course ends there: a MAC that only adds and subtracts, a neuron that can answer not sure, a bar detector and a small layer.
Two modules leave the toy world. The instruction word is the 32-bit word the pinned Trinity emulator decodes: 47 of 256 opcode bytes mean something and the other 209 decode as NOP. The widgets call encode(), opcode_of() and the rest from specs/isa/ternary_encoding.t27. A ternary machine of three 9-trit registers then runs a loop that ends itself on a three-way jump.
The logic is two new specs in gHashTag/t27, trits.t27 and radix_economy.t27: 21 tests, every one executing its asserts, 8 negative controls caught. They read balanced trits through the offset 111...1 in base 3, so no signed division is needed. The 27 widgets share one drawing kit that computes nothing; scripts/widget-logic.mjs holds every compiled logic.js to the spec beside it. Lesson texts quote only numbers the specs or widgets produce, and where a lesson spec is a different machine, such as the binary adders built from ternary neurons, the text says so.
Work with me
I design low-precision and ternary formats, synthesizable RTL, independent reference models and bit-exact vectors. Existing measured cores can also be licensed.