Close

Balanced Ternary Numbering System

A project log for Ternary Computing Menagerie

A place for documenting the many algorithms, data types, logic diagrams, etc. that would be necessary for the design of a ternary processor.

mechanical-advantageMechanical Advantage 04/13/2019 at 07:020 Comments

A binary digit is a bit, a ternary digit is a trit.

The number of possible values that can be represented by x number of digits in a number system with base n is n^x. For example:

# of digitsBase-2 valuesBase-3 values
123
249
3827
41681
532243
664729
71282,187
82566,561

As you can see, a ternary system triples the number of possible values with each additional trit whereas the binary system doubles.

The balanced ternary numbering system is a positional numbering system where the position of each digit determines its relative magnitude. Numbers further to the left have greater magnitude and numbers further to the right have lesser magnitude.

Here is a decimal example and a ternary (unbalanced) example:

Decimal:                     841 = (8*100) + (4*10) + (1*1) = Eight hundred and forty-one

Unbalanced Ternary: 201 = (2*9)    + (0*3)  + (1*1)  = Nineteen

One facet of positional numbering that is so obvious it is unlikely to be noted is that they count upwards from zero. This is quite natural and, in fact, cannot be otherwise in most cases unless you add a sign to indicate that the number is negative and you are counting down from zero.

This is not particularly interesting until you take into account the term "balanced". Unlike other systems in common use, balanced ternary has an odd-numbered base. This makes possible an arrangement that cannot be done with any even-numbered base like binary, decimal, etc. Because there is an odd number of possible values, you can arrange them such that they fall on both sides of zero. In other words, the digit in each position may be either negative or positive. The three possible values for a given trit are -1, 0, and 1. Negative one is denoted with "-", one is denoted with "+" and a zero with "0".

Let's look at our previous examples compared to balanced ternary:
Decimal:                     841 = (8*100) + (4*10) + (1*1) = Eight hundred and forty-one
Unbalanced Ternary: 201 = (2*9)   + (0*3)  + (1*1) = Nineteen
Balanced Ternary:     -+0 = (-1*9)  + (1*3) 0 (0*1)  = Negative six

Notice that we were able to represent a negative number without a negative sign. The sign of the number overall is the sign of the most significant (leftmost) trit. In balanced ternary, all numbers are natively signed or unsigned without recourse to specialized systems such as 2's-complement or sign-magnitude.

Here are a few more examples:

-0+0   = (-1*27) + (0*9)   + (1*3)  + (0*1) = -24
0++-   = (0*27)  + (1*9)    + (1*3)  + (-1*1) = 11
+---     = (1*27)   + (-1*9)   + (-1*3) + (-1*1) = 14
00-0  = (0*27)  + (0*9)  + (-1*3)  + (0*1) = -3
++++   = (1*27)   + (1*9)   + (1*3)   + (1*1) = 40
0000 = (0*27)  + (0*9)  + (0*3)  + (0*1) = 0
----      = (-1*27)  + (-1*9)  + (-1*3) + (-1*1) = -40

Discussions