ternary-representation

Convert decimal to balanced Heptavintimal

允我心安 提交于 2021-01-27 06:31:37
问题 I'm trying to make a function to convert decimal to balanced Heptavintimal (0123456789ABCDEFGHKMNPRTVXZ) where 0 represent -13, D : 0 and Z 13 I have tried this but some cases are not working properly: static const std::string HEPT_CHARS = "0123456789ABCDEFGHKMNPRTVXZ"; std::string heptEnc(int value){ std::string result = ""; do { int pos = value % 27; result = std::string(HEPT_CHARS[(pos + 13)%27] + result); value = value / 27; } while (value != 0); return result; } Here is what I get in

Why binary and not ternary computing?

对着背影说爱祢 提交于 2019-11-27 17:47:16
Isn't a three state object immedately capable of holding more information and handling larger values? I know that processors currently use massive nets of XOR gates and that would need to be reworked. Since we are at 64 bit (we can represent 2^63 possible states) computing the equivalent ternary generation could support number with 30 more tens places log(3^63-2^63). I imagine it is as easy to detect the potential difference between +1 and 0 as it is between -1 and 0. Would some compexity of the hardware, power consumption, or chip density offset any gains in storage and computing power?

Why binary and not ternary computing?

做~自己de王妃 提交于 2019-11-26 19:07:18
问题 Isn't a three state object immedately capable of holding more information and handling larger values? I know that processors currently use massive nets of XOR gates and that would need to be reworked. Since we are at 64 bit (we can represent 2^63 possible states) computing the equivalent ternary generation could support number with 30 more tens places log(3^63-2^63). I imagine it is as easy to detect the potential difference between +1 and 0 as it is between -1 and 0. Would some compexity of