|
|
|
|
|
by paulddraper
3450 days ago
|
|
If you're looking for true beauty, look no further than negabinary. (http://mathworld.wolfram.com/Negabinary.html) E.g. 3 = (-2)^2 + (-2)^1 + (-2)^0 = 0110_-2
-3 = (-2)^3 + (-2)^2 + (-2)^0 = 1101_-2
There is no signed bit, you don't have to worry about sign; everything just works like "normal" numbers because that in fact is what it is.A pity it was never used except a few times in early computing. I'm never sure why 2's-complement won. |
|
Maybee conversion to/from character code is easier. Notice the conversion code in the linked article.