*** Welcome to piglix ***

Ternary numeral system


The ternary numeral system (also called base-3) has three as its base. Analogous to a bit, a ternary digit is a trit (trinary digit). One trit is equivalent to log23 (about 1.58496) bits of information.

Although ternary most often refers to a system in which the three digits 0, 1, and 2 are all non-negative numbers, the adjective also lends its name to the balanced ternary system, comprising the digits -1, 0 and +1, used in comparison logic and ternary computers.

Representations of integer numbers in ternary do not get uncomfortably lengthy as quickly as in binary. For example, decimal 365 corresponds to binary 101101101 (9 digits) and to ternary 111112 (six digits). However, they are still far less compact than the corresponding representations in bases such as decimal – see below for a compact way to codify ternary using nonary and septemvigesimal.

As for rational numbers, ternary offers a convenient way to represent 1/3 (as opposed to its cumbersome representation as an infinite string of recurring digits in decimal); but a major drawback is that, in turn, ternary does not offer a finite representation for 1/2 (neither for 1/4, 1/8, etc.), because 2 is not a prime factor of the base; as with base-2, 1/10 is not representable exactly (that would need e.g. base-10); nor is 1/6.


...
Wikipedia

...