Editing Talk:1275: int(pi)

Jump to: navigation, search
Ambox notice.png Please sign your posts with ~~~~

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 11: Line 11:
  
 
Prudent mathematicians just refer to it as "The Scottish Number". [[User:Dr Pepper|Dr Pepper]] ([[User talk:Dr Pepper|talk]]) 06:58, 9 October 2013 (UTC) Dr Pepper
 
Prudent mathematicians just refer to it as "The Scottish Number". [[User:Dr Pepper|Dr Pepper]] ([[User talk:Dr Pepper|talk]]) 06:58, 9 October 2013 (UTC) Dr Pepper
โˆ’
: Ha! Now I understand the ''real'' reason for the subtitle to [http://en.wikipedia.org/wiki/Symphony_No._3_%28Mendelssohn%29 Mendelssohn's third symphony.] [[User:Opusthepenguin|Opusthepenguin]] ([[User talk:Opusthepenguin|talk]]) 16:30, 28 October 2013 (UTC)
 
  
 
I can give you one '''rational''' reason for spelling out things like INT(PI) in programming. Back in the ancient times, there was a piece of electronics dubbed then a ''personal computer'' with an NSA code name of ZXSPECTRUM. It had a built-in interpreter of the ancient language codenamed BASIC. Memory was very precious in those times, every single byte counted. The creators of the interpreter did a (somewhat) clever thing - all keywords of this particular dialect of the BASIC language were stored in memory as single-byte codes, and were only spelled out by text display routines. On the other hand, CPU cycles were precious, too, so they did another (not so) clever thing by storing number constants (like the cursed number mentioned above) twofold - both in an ASCII decimal form for display purposes and in a 6-byte internal binary form for computing purposes. Therefore each number occupied the space of six bytes plus the number of digits (or other characters like sign, decimal point, etc.) BASIC hackers exploited this (mis)features to save a few bytes on some commonly-used constants by saying INT PI (parentheses were not needed), NOT PI (to get 0) or SGN PI (to get 1), thus using only 2 bytes of memory instead of 7 if the numbers were used directly. Another trick to use with larger numbers was VAL "12345", which saved 3 bytes for each number spelled this way (number of digits plus three bytes for the VAL keyword and two quote marks instead of number of digits plus six bytes of internal representation). [[Special:Contributions/89.174.214.74|89.174.214.74]] 08:43, 9 October 2013 (UTC)
 
I can give you one '''rational''' reason for spelling out things like INT(PI) in programming. Back in the ancient times, there was a piece of electronics dubbed then a ''personal computer'' with an NSA code name of ZXSPECTRUM. It had a built-in interpreter of the ancient language codenamed BASIC. Memory was very precious in those times, every single byte counted. The creators of the interpreter did a (somewhat) clever thing - all keywords of this particular dialect of the BASIC language were stored in memory as single-byte codes, and were only spelled out by text display routines. On the other hand, CPU cycles were precious, too, so they did another (not so) clever thing by storing number constants (like the cursed number mentioned above) twofold - both in an ASCII decimal form for display purposes and in a 6-byte internal binary form for computing purposes. Therefore each number occupied the space of six bytes plus the number of digits (or other characters like sign, decimal point, etc.) BASIC hackers exploited this (mis)features to save a few bytes on some commonly-used constants by saying INT PI (parentheses were not needed), NOT PI (to get 0) or SGN PI (to get 1), thus using only 2 bytes of memory instead of 7 if the numbers were used directly. Another trick to use with larger numbers was VAL "12345", which saved 3 bytes for each number spelled this way (number of digits plus three bytes for the VAL keyword and two quote marks instead of number of digits plus six bytes of internal representation). [[Special:Contributions/89.174.214.74|89.174.214.74]] 08:43, 9 October 2013 (UTC)

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)

Templates used on this page: