Hacker News new | ask | show | jobs
by jsmthrowaway 3105 days ago
With balanced ternary, setting aside a bit for signed words goes away. We'd stop having to think about signed versus unsigned, and we'd get the full word width if it were based on trits, regardless of the sign. It makes a lot of sense. It also has dramatic implications for floating point, I understand, though I grok that aspect a bit less. If you go unbalanced (I think is the term?) and let each trit express one of three trinary digits from 0 to 2 in an integer, then a 64-trit word can make it 11 significant digits further (3^64-1), and this is a pain point in game engines trying to express astronomical distances such as Star Citizen. You'd open up a number of cool primitive data types; I could see a balanced integer being "signed" and an unbalanced integer being "unsigned/long" for example, and relative pointers could go backwards without having to do a ssize_t-style dance, etc., etc. Tri-states give a native word a lot of possibilities.

There's a lot of people thinking in ternary already, and not realizing it. bool? is ternary: true, false, or null. Think about the implications on error handling of such a primitive at the logic level. I'm positive that's true, I'm positive that's false, I'm not sure. It's a pretty powerful way of computing, and has a lot of implications up the stack.

If you step back and look at the gymnastics we do around boolean logic and arithmetic in typical, day-to-day programming, being able to express a third state at the logic level is something you never knew you wanted. New logic based on unknown values could be expressed -- think about a tritmask, for example, and what you could express with a number of "don't care" trits. I certainly see the value in ternary, with the caveat that I know nothing about IOTA nor how it uses it.

I've seen discussion about "why don't we build 128-bit computers?" and I think it's a similar thought exercise to "why don't we build 63-trit computers?" with the added complexity of three-level logic compared to plain word extension. I gather that a lot of benefits of ternary overlap with what's going to happen in quantum computing, too, though approaching ternary from a traditional computing mindset makes it a lot easier to understand for me.