Syntactic Confectionery Delight PerlMonks

### Re: Re: Negabinary Number System

by dragonchild (Archbishop)
 on Sep 06, 2001 at 18:20 UTC ( #110582=note: print w/replies, xml ) Need Help??

in reply to Re: Negabinary Number System

It makes perfect sense that representation that gets to use 150% more types would need roughly 66% as many positions. *grins*

Tell us more about balanced ternary, please. Why is it pretty? (What is TAOCP?)

------
We are the carpenters and bricklayers of the Information Age.

Vote paco for President!

Replies are listed 'Best First'.
Re: Re: Re: Negabinary Number System
by Cirollo (Friar) on Sep 06, 2001 at 22:27 UTC
Ah, sorry. TAOCP is The Art of Computer Programming by Donald Knuth.

Here are some of the reasons Knuth gives for the "prettiness" of balanced ternary:

You can get the negative of a number simply by interchanging all of the 1's and -1's.

The sign of a number can be found from it's most significant (aka leftmost) nonzero digit; positive if it is 1, negative if it is -1 (again, the sign is contained in the number itself)

The operation of rounding to the nearest integer is identical to truncation, or simply deleting everything to the right of the radix (decimal) point; this is another consequence of using a "balanced" system. The reason for this is that fractional values will range from -1/2 to 1/2 (the largest fractional value you could have, 0.1, is 1/2 in base 10); so, any fractional number is expressed as it's nearest integer, plus or minus some value up to 1/2.

Re: Re: Re: Negabinary Number System
by srawls (Friar) on Sep 06, 2001 at 22:29 UTC
TAOCP is The Art of Computer Programming.

A few reasons why Knuth considers it as pretty are:
1)The negative of a number is obtained by changing all 1s to -1s and all -1s to 1s;
2)The sign is the sign of it's most significant trit (trinary digit); and
3)Rounding to the nearest integer is identicle to truncating.

Oh, and Cirollo; thanks for the reminder. I had forgotten about the balanced ternary system, but remembered it once I saw the name of it. Perhaps I will do my research on that, I'll wait and see. Update:Hey Cirollo, looks like you beat me to the punch : ) Thanks again!

The 15 year old, sophmore programmer,
Stephen Rawls

Create A New User
Node Status?
node history
Node Type: note [id://110582]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2018-06-22 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should cpanminus be part of the standard Perl release?

Results (120 votes). Check out past polls.

Notices?