XXIIVV

Ternary numbers are a base 3 numeral system.

Base 10 is famously well suited to those of us who count on our fingers. Base 2 dominates computing technology because binary devices are simple and reliable, with just two stable states on or off. The cultural preference for base 10 and the engineering advantages of base 2 have nothing to do with any intrinsic properties of the decimal and binary numbering systems.

Truth valueUnsignedBalanced
false0-
unknown10
truth2+

Base 3, on the other hand, does have a genuine mathematical distinction in its favor. By one plausible measure, it is the most efficient of all integer bases; it offers the most economical way of representing numbers as it is closer than binary to the most economical radix base(2.718) to represent arbitrary numbers, when economy is measured as the product of the radix and the number of digits needed to express a given range of values.

While you can see at a glance whether a binary number is even or odd by looking at the last digit, it is subtler with ternary in which a numeral represents an even number if the numeral has an even number of 1s.

Balanced Ternary

The digits of a balanced ternary numeral are coefficients of powers of 3, but instead of coming from the set {0, 1, 2}, the digits are {-, 0 and +}. They are balanced because they are arranged symmetrically about zero.

UnsignedBalanced
Dec.Tern.Tern.Dec.
000---4
101-0-3
202-+-2
3100--1
411000
5120+1
620+-2
721+03
822++4

Arithmetic is nearly as simple as it is with binary numbers; in particular, the multiplication table is trivial. Addition and subtraction are essentially the same operation: Just negate one number and then add. Negation itself is also effortless: Change every N into a 1, and vice versa. Rounding is mere truncation: Setting the least-significant trits to 0 automatically rounds to the closest power of 3.

Perhaps the prettiest number system of all is the balanced ternary notation. Donald E. Knuth, The Art of Computer Programming

Notes on Ternary Logic.

Along with ternary arithmetic, a computer built of ternary hardware can also exploit ternary logic. Consider the task of comparing two numbers. In a machine based on binary logic, comparison is often a two-stage process. First you ask, "Is x less than y?"; depending on the answer, you may then have to ask a second question, such as "Is x equal to y?" Ternary logic simplifies the process: A single comparison can yield any of three possible outcomes: "less," "equal" and "greater."

Single Input Gates

The gate names uses the heptavintimal notation.

Reversible Gates

To learn more, see reversible computing.

+0-NumberNameDefinitions
0----13FalseNEG(LAX(LAX))
A--0-12NEG(LAX)
B--+-11Decoder(-)DEC(DEC(LAX))
C-0--10AbnNEG(LAX(DEC))
D-00-9DEC(LAX(NEG))
E-0+-8NegationNEG
F-+--7Decoder(0)DEC(DEC(LAX(DEC)))
G-+0-6IncrementDEC(DEC)
H-++-5DEC(NEG(LAX(NEG)))
I0---4NEG(LAX(NEG))
J0-0-3DEC(LAX(DEC))
K0-+-2DecrementDEC
L00--1DEC(LAX)
M0000ClearDEC(LAX(LAX))
N00+1NEG(DEC(LAX))
O0+-2NEG(DEC)
P0+03NEG(DEC(LAX(DEC)))
Q0++4LAX(NEG)
R+--5Floor/Decoder(+)DEC(DEC(LAX(NEG)))
S+-06DEC(NEG)
T+-+7DEC(NEG(LAX(DEC)))
U+0-8IdentityNEG(NEG)
V+009FlatNEG(DEC(LAX(NEG)))
W+0+10AbsLAX(DEC)
X++-11CeilDEC(NEG(LAX))
Y++012LaxLAX
Z+++13TrueLAX(LAX)
AND B
F U T
A F F F F
U F U U
T F U T
OR B
F U T
A F F U T
U U U T
T T T T
Inputs Outputs
X Y TNAND TNOR
−1 −1 1 1
−1 0 1 0
−1 1 1 −1
0 −1 1 0
0 0 0 0
0 1 0 −1
1 −1 1 −1
1 0 0 −1
1 1 −1 −1

incoming ternary logic heptavintimal ternary computing terscii