# Let’s think for three. Ternary computers

In everyday life, we use the decimal number system. Why exactly it is a separate question. After all, there are systems with base 12 (on the phalanges of fingers without a thumb), 5 (fingers on one hand), 20, 60, and so on. In computers, everything is somewhat simpler – there (one might even say, “Traditionally”), the binary system is used as the easiest to implement. There is current, there is no current. There is a hole in the punched card – there is no hole. Zero or one. In short, “yes” or “no” – there is no middle ground. What happens if you give? We’ll talk about this.

Actually, there are two possibilities to “give” this very third: in the form of “0, 1, 2” or in the form of “-1, 0, 1”. The first system is called asymmetric, the second – symmetrical. In itself, the introduction of the ternary number system is beneficial in that the efficiency of storing data for each digit is higher than for any other number system. This is due to the fact that, as they say, “God counts by E”, and the most economical is the system with a base equal to Euler number (see proof at page 37), and three is closer to E than two.
But that’s not all – if an asymmetric system is just an “extension” of a binary one, allowing you to store more information in one cell, then a symmetrical system has much more benefits.

One of these benefits is the appearance of the value “0”, that is, “not defined”. As a rule, 0 conveys the absence of a value, and 1 and -1 (sometimes “+” and “-” are used instead of numbers) – binary “yes” and “no”. How can this be beneficial? In general, it depends on how the work of logic is set. For example, a binary computer faced with a paradoxical request in the spirit of “The second statement is true – the first statement is false” will fall into a stupor. The ternary computer can simply return 0 in response – it will not answer, but it will avoid the answer. Or 1 – if it works on the “logic of paradox”. Well, besides this, many questions can be improved – for example, not “presence / absence”, but “lack / norm / excess”.

What a terrible dream! There were zeros and ones everywhere. And it seemed to me that I saw a deuce!
“Bender, it’s just a dream. Twos don’t exist.

The second benefit is negative values. In the binary system, to show that a number has a negative value, an additional sign is needed. In the ternary system, if the leading bit of a number is negative, then the number is also negative. The sign change from positive to negative and vice versa is achieved by inverting all its digits (what is most interesting, the Soviet ternary computer Setun perceived “inversion” literally – negative numbers were printed upside down).

From the previous two points, the third comes out – increased computation speed with a reduced amount of memory occupied. In the binary system, two digits are needed to show the sign of a number, but in the ternary system, only one digit (actually, the number itself) is needed. Next is addition, the most frequently performed operation, which is greatly hampered by transfers from category to category – in the case of a binary system, they occur in 50% of cases, and in a ternary (symmetric) system – in 8 cases out of 27, i.e., approximately in 29.6% of cases. Higher speed and fewer elements increase the speed of the ternary machine by about 1.6 times, and, accordingly, reduce power consumption.

Well, or something like that

It would seem, why is such an engineering “wunderwaffe” not used everywhere? There are several reasons for this. The most basic is that no one especially developed them. The most famous example of a ternary computer is the Soviet Setun, developed in the 1950s. It is unique not even because it is the first ternary computer (but not first ternary computer), but because the employees of the computer laboratory of Moscow State University assembled it literally on their knees and from improvised materials, because:

… we had to get a car for Moscow State University M-2made in Brook’s lab. But it turned out to be a mess. In the election of academicians Sergey Lvovich Sobolev – our leader – voted not for Brook, but for Lebedev. Brook was offended and did not give the car.

Fowler’s ternary adding machine is the first ternary calculator:

“Setun”

was also developed “Setun-70” – a fundamentally new machine with stacks of commands and operands (developed, which is typical, for the 100th anniversary of the birth of Lenin). Neither the original nor the 70th “Setun” went into a large series – the original, for reasons that are not entirely clear, was very prosaically “strangled”, and the 70th was a single copy. And besides “Setun” … there was nothing. The Americans at one time experimented with ternary logic, and even made some progress, but it did not come to the construction of full-fledged computers (the maximum is the Ternac ternary logic emulator for a binary machine, which was written in FORTRAN). In Canada, in the 80s, a ROM chip was developed based on asymmetric ternary logic (you can create a similar chip yourself). In the 90s, ternary was developed

programming language TriINTERCAL

– again, based on asymmetric ternary logic. Some developments are still underway, although they are not a priority. In other words, there is simply no experience or material base for their widespread use.

Actually, “Setun”. Quite compact compared to competitors

From this comes the second problem – we are simply used to binary computers. Initially, they were a much simpler solution (making a detector “there is current – there is no current” was much easier than “current is lower – current is rated – current is higher” – but the current had to be precisely controlled …). Over time, there have become so many of them, and they have become so well studied that there is no need for any more advanced systems yet (!) Moreover, all currently existing computer programs are sharpened specifically for binary logic. If you introduce ternary computers into use, then you either need to write your own programs for them (which is expensive and time consuming), or make them compatible with binary ones – and this is not always possible, and perhaps even more difficult.

However, if one does decide to invest time and money in the development of ternary machines and programs, then, potentially, this will lead to a significant increase in the power of computers around the world, and, theoretically, may even reduce the need for nanometer microprocessors. technical process. Plus, do not forget about such a fun thing as quantum computers. In quantum physics, little is understood even by those people who have been studying it for half their lives. For example, a quantum can be both a wave and a particle. When it is not clear what state the quantum is in, this is called “Superposition”, which can be reflected by the additional value of ternary logic. In general, the field of possibilities opened up by ternary computers is infinite.

It is not clear only when and in which direction this field should begin to cross.