Of course it does. The representation of numbers is irrelevant, as long as its interface doesn’t change.
The only place you’d see changes are in bitwise/tritwise operations and in limits of fixed-size integers (abs(i) would likely be well defined for all ints, for example, and we would have INT_MAX = -INT_MIN, with values like 3^81 or 3^27).
Ternary floats probably would do away with the distinction between -0 and +0, too.
Which is also why I don't see any reason why we'd need a new "language" to use ternary computing. I'm not even sure what a library would do; if you have arbitrary precision ints and/or floats, that's basically all you need for an adapter. For instance, a ternary computer might be able to store a tri-state value more efficiently, but you'd still have the exact same code to resolve it ("case 0: {} case 1: {} case 2: {}"), and it's not like it suddenly mandates that all your binary conditions grow a third clause lest the hardware combust. A trit having more room than a binary value requires isn't news when a lot of our binary values are already consuming a full byte, if not at times a full machine word, as it is.
I've seen one other person in the past many years who A: believed ternary computing was very important and B: was absolutely impossible to convince that there is literally nothing a ternary computer can do that a binary computer can not.
But there is literally nothing a ternary computer can do that a binary computer can not. The reasons why it may be interesting relate to being one possible avenue for squeezing one last drop of hardware performance out of a system that has otherwise reached its limits, but it is minimally interesting from a software perspective.
I think no one is particularly interested in it at this time because there's no step after that; there's no "super ternary" you can go to after that, and for various mathematical reasons stepping up to 4 is much, much less helpful if not actively a step backwards (it turns out that in many ways, 3 is the optimum; actually it's e, but 3 is the closest you can get to that). An optical computer might go faster the next generation, a quantum computer can add more qubits, transistors can be cooled and stacked and built out of graphene and all sorts of other things, but a ternary-ness is a dead end. It's the last thing you do when all else fails.
What are your thoughts on ternary computation and neural nets, or general use of it? I myself want to explore some more use cases with utility rather than yak/shaving.
Neural nets usually use 32-bit floats for weights. There is a rapid trend of using quantization. There are already papers describing 2-bit quantization strategies – either quantization-aware training or post-training quantization. Less precision means larger & faster models (current utility), buuuut more importantly you can start to think about different substrates for implementation – analog or optical seems to be viable paths.
The "bruijn" programming language [1] also uses balanced ternary. Its author says:
> For example, bruijn uses the results of an investigation by Torben Mogensen [2] to implement very efficient operations on balanced ternary numbers.
The Abstract of the referenced paper reads:
> We argue that a compact right-associated binary number representation gives simpler operators and better efficiency than the left associated binary number representation proposed by den Hoed and investigated by Goldberg. This representation is then generalised to higher number-bases and it is argued that bases between 3 and 5 can give higher efficiency than binary representation.
Typically, binary representations of trinary numbers use a trit that is two bits. So you have four states: -1,0,+1, and uh, something else, which is usually a guard bit of some kind or a NaN. Please, please, don't ask me why I know too much about trinary. But one worries about the representation.
It looks like this one stores trits as strings and numbers are then arrays of trit strings.
Agreed, the problem with ternary on a binary level is that it requires twice the bit width to represent it. For example a normal binary element is 0/1 now you need, -1/0/+1, in turn you now need two 0/1 0/1 to represent a ternary which is inefficient. It also means it is incomplete as there will always be a 4th binary placeholder. Putting 3 into 2 is wasteful.
I would prefer if we just made some silicon for this.
If you count communication signalling, you do not need to go that exotic. Gigabit Ethernet has 5 levels.
At the chip level, it is quite common to see tri-state pins, where the states are: high, low, high-impedidence (e.g, let the rest of the circut set the voltage level). You also sometimes see chips that want a to support a handful of potential values have a pin that can be pulled to multiple intermediate voltages; although you typically hardwire the value with resistors.
If you go back far enough, decimal computers were common. The first "real" computer was thr ENIAC which was finished in 1945, and was decimal based. Although even before that, there were more primitive digital computational devices of both the binary and decimal variaty.
Or, Google for: "Brousentsov's Ternary Principle" and/or "Bergman's Number System" and/or "Ternary Mirror-symmetrical Arithmetic".
Keywords: Ternary Symmetrical Number System, Ternary Tau, Base Phi, Golden Ratio, Fibonnacci, 3-Valued Logic, Number Systems With Transcendental/Irrational Bases, etc., etc.
Related: How e, Pi and Phi are related (despite appearing very different at the surface level!)...
Many years ago in a team meeting, I was explaining the need for an additional bit (yes, bit) to our mainframe programmer, because the value had three positions. I then explained, we'd use ternary math on it. HE WAS DEEPLY OFFENDED. Left the meeting telling us we weren't allowed to just invent new math.
Not quite the same thing, but some industries use 4 state “booleans” to describe the state of machinery.
For example, in power stations, the position of switch gear would use 10 and 01 for on/off, 00 for “switch gear in motion” (ie, transiting from on to off or vice versa) and 11 to represent an error state. The in transit condition can persist for several minutes.
29 comments
[ 3.0 ms ] story [ 35.1 ms ] threadThe only place you’d see changes are in bitwise/tritwise operations and in limits of fixed-size integers (abs(i) would likely be well defined for all ints, for example, and we would have INT_MAX = -INT_MIN, with values like 3^81 or 3^27).
Ternary floats probably would do away with the distinction between -0 and +0, too.
I've seen one other person in the past many years who A: believed ternary computing was very important and B: was absolutely impossible to convince that there is literally nothing a ternary computer can do that a binary computer can not.
But there is literally nothing a ternary computer can do that a binary computer can not. The reasons why it may be interesting relate to being one possible avenue for squeezing one last drop of hardware performance out of a system that has otherwise reached its limits, but it is minimally interesting from a software perspective.
I think no one is particularly interested in it at this time because there's no step after that; there's no "super ternary" you can go to after that, and for various mathematical reasons stepping up to 4 is much, much less helpful if not actively a step backwards (it turns out that in many ways, 3 is the optimum; actually it's e, but 3 is the closest you can get to that). An optical computer might go faster the next generation, a quantum computer can add more qubits, transistors can be cooled and stacked and built out of graphene and all sorts of other things, but a ternary-ness is a dead end. It's the last thing you do when all else fails.
What are your thoughts on ternary computation and neural nets, or general use of it? I myself want to explore some more use cases with utility rather than yak/shaving.
> For example, bruijn uses the results of an investigation by Torben Mogensen [2] to implement very efficient operations on balanced ternary numbers.
The Abstract of the referenced paper reads:
> We argue that a compact right-associated binary number representation gives simpler operators and better efficiency than the left associated binary number representation proposed by den Hoed and investigated by Goldberg. This representation is then generalised to higher number-bases and it is argued that bases between 3 and 5 can give higher efficiency than binary representation.
[1] https://bruijn.marvinborner.de/
[2] https://link.springer.com/chapter/10.1007/3-540-45575-2_20 "An Investigation of Compact and Efficient Number Representations in the Pure Lambda Calculus"
EDIT: Just saw user 'jerf' post the same below
It looks like this one stores trits as strings and numbers are then arrays of trit strings.
I would prefer if we just made some silicon for this.
At the chip level, it is quite common to see tri-state pins, where the states are: high, low, high-impedidence (e.g, let the rest of the circut set the voltage level). You also sometimes see chips that want a to support a handful of potential values have a pin that can be pulled to multiple intermediate voltages; although you typically hardwire the value with resistors.
If you go back far enough, decimal computers were common. The first "real" computer was thr ENIAC which was finished in 1945, and was decimal based. Although even before that, there were more primitive digital computational devices of both the binary and decimal variaty.
"Brousentsov's Ternary Principle, Bergman's Number System and Ternary Mirror-symmetrical Arithmetic" by Alexy Stakhov:
https://www.semanticscholar.org/paper/Brousentsov%27s-Ternar...
Also available here (but apparently behind a registration/paywall of some sort...):
https://www.researchgate.net/publication/220458145_Brousents...
Or here:
https://ieeexplore.ieee.org/document/8140230
Or, Google for: "Brousentsov's Ternary Principle" and/or "Bergman's Number System" and/or "Ternary Mirror-symmetrical Arithmetic".
Keywords: Ternary Symmetrical Number System, Ternary Tau, Base Phi, Golden Ratio, Fibonnacci, 3-Valued Logic, Number Systems With Transcendental/Irrational Bases, etc., etc.
Related: How e, Pi and Phi are related (despite appearing very different at the surface level!)...
Someone let the mathematicians know!
Python has `True or False or None`, which you conventionally test with `is`
For example, in power stations, the position of switch gear would use 10 and 01 for on/off, 00 for “switch gear in motion” (ie, transiting from on to off or vice versa) and 11 to represent an error state. The in transit condition can persist for several minutes.