OT: Number bases
From: | Henrik Theiling <theiling@...> |
Date: | Wednesday, February 11, 2009, 12:03 |
Hi!
Mark J. Reed writes:
> Balanced ternary and base -2 have both been proposed seriously in
> academic circles, because they avoid the arbitrariness of modern sign
> representation schemes (though 2's complement is unarguably elegant).
>...
Well, I don't like it because it's, well, not balanced. And usually
floats and multiprecision libraries (e.g. libgmp) use unsigned + a
sign bit as a representation, also because printing a number is easier
then (with two's complement, you have to negate a negative number to
print it for humans), so there are always two ways out there to
represent a signed number.
Ternary logic would also eliminate those awful hacks from computer
languages: unsigned numbers. They are a major cause for serious bugs
like buffer overflows and integer underflows. Humans just don't care
whether a number is signed or unsigned (and rightly so), so
programmers make mistakes. (Ok, higher level languages today have no
unsigned numbers anymore, but there are still recent invensions that
keep this plague.)
Balanced ternary would be much more elegant for many things
(e.g. strcmp...). But electrically, I think it is much more
complicated than binary, I think. And, of course, it's virtually
impossible to switch now.
**Henrik
Reply