HAKMEM
Author |
Message |
bugzpodder
![](http://www.vbforums.com/avatar.php?userid=31755&dateline=1038631511)
|
Posted: Thu Dec 14, 2006 4:16 pm Post subject: HAKMEM |
|
|
Item 154 (Bill Gosper): The myth that any given programming language is machine independent is easily exploded by computing the sum of powers of 2. If the result loops with period = 1 with sign +, you are on a sign-magnitude machine. If the result loops with period = 1 at -1, you are on a twos-complement machine. If the result loops with period greater than 1, including the beginning, you are on a ones-complement machine. If the result loops with period greater than 1, not including the beginning, your machine isn't binary "” the pattern should tell you the base. If you run out of memory, you are on a string or bignum system. If arithmetic overflow is a fatal error, some fascist pig with a read-only mind is trying to enforce machine independence. But the very ability to trap overflow is machine dependent. By this strategy, consider the universe, or, more precisely, algebra: Let X = the sum of many powers of 2 = ...111111 (base 2). Now add X to itself: X + X = ...111110. Thus, 2X = X - 1, so X = -1. Therefore algebra is run on a machine (the universe) that is two's-complement.
http://catb.org/jargon/html/H/HAKMEM.html |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
ZeroPaladn
|
Posted: Fri Dec 15, 2006 2:17 pm Post subject: (No subject) |
|
|
I'm having trouble understanding this...
So each type of computer is diffferent, and this procedure described in the article can determine what type of mathematical logic your computer uses?
And if this is so, how would you implement this in a programming language? |
|
|
|
|
![](images/spacer.gif) |
bugzpodder
![](http://www.vbforums.com/avatar.php?userid=31755&dateline=1038631511)
|
Posted: Sat Dec 16, 2006 11:58 am Post subject: (No subject) |
|
|
lol its more of nerd trivia... all our computers are 2's compliment these days |
|
|
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Tue Dec 19, 2006 1:38 pm Post subject: (No subject) |
|
|
its just proving that the universe itself is two's compliment ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|