Re: OT: Number bases
From: | Chris Wright <dhasenan@...> |
Date: | Thursday, February 12, 2009, 13:51 |
2009/2/12 Henrik Theiling <theiling@...>:
> Hi!
>
> Mark J. Reed writes:
>> On Thu, Feb 12, 2009 at 6:57 AM, Henrik Theiling <theiling@...> wrote:
>>> Ah, now I understand what you mean. You're right. So you'd expect a
>>> ternary CPU'd still have both signed and unsigned arithmetics even if
>>> the CPU was build with balanced ternary logic in mind?
>>
>> No, I wouldn't. While, as with two's complement, the basic truth
>> tables at the single-trit level is the same (given states 0, 1, and X,
>> the result of adding two trits is the same whether X is treated as -1
>> or 2), the carry out is different, so hardware adders would have to
>> be designed explicitly one way or the other. So the choice has to be
>> made sooner, at a more fundamental level. I was just pointing out
>> that it was still a choice. :)
>
> Argh. :-) So we're discussing this just because you wanted to nitpick?
> Well, well! :-)))
>
> So I can still rightfully hope for ternary computers to eliminate
> unsigned ints! Maybe one day, when Moore's law will have failed us,
> someone finds some trick that can make electronic circuits smaller,
> but only if they use ternary logic.
No, it'll be like floating point arithmetic: a processor will have
separate circuitry for signed and unsigned math.
> All hackers who can sing 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
> 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144 in their sleep
> will cry and will have to learn a new series just to be called
> 'hacker'! And in C, which will undoubtfully still be around, we need
> a new number prefix for base 3 (oh wait, 0b is not standard C), base 9
> (base 4 is not used either), and base 27. And how to we write the
> balanced base 27 digit -10 in C?? Maybe we use UPPER CASE!
What programming language do you use that allows writing binary
integer literals with a 0b prefix?
> I once wrote a source code obfuscator that reformatted all numbers to
> base-3 (including chars in C). That's really hard to read for the
> average hacker. :-)
So it would express 97 as (1*81) + (0*27) + (1*9) + (2 * 3) + (1*1)?
> **Henrik
>
Replies