Hacker News new | past | comments | ask | show | jobs | submit login

> Control flow, bit masking, and a mountain of other useful things are all predicated on boolean logic. At best it would be a waste of an extra bit, and would also introduce ambiguity and complexity at the lowest levels of the machine, where simplicity is paramount.

There is an even bigger mountain of useful things predicated on ternary logic waiting to be discovered. "Tritmasks" would be able to do so much more than bitmasks we are used to as there would be one more state to assign a meaning to. I'm not sure if the implementation complexity is something we can ever overcome, but if we did I'm sure there would eventually be a Hacker's Delight type of book filled with useful algorithms that take advantage of ternary logic.




Yes, I am sure, that's why ternary logic is such a widely studied math field compared to boolean logic /s. No really, can you give an example where ternary logic is actually considerably more useful than the log(3)/log(2) factor of information density?


I don't know of any concrete examples of "tritwise tricks" (this is not my area of expertise). But as ternary logic is a superset of boolean logic there are more possibilities available (3*3=9 different state transitions compared to 2*2=4) and some of them are bound to be useful. For example it should be possible to represent combinations of two bitwise operations as an equivalent tritwise operation (eg. x XOR A OR B where A and B are constants in binary could become x "XOROR" C in ternary) – but that feels like an example constructed by someone who is still thinking in binary. I'm certain that someone much smarter than me could come up with ternary-native data types and algorithms.

If ternary logic has not been widely studied I assume there is a lot to be discovered still.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: