Thread: 0 vs. 00
View Single Post
  #18 (permalink)  
Old Fri Dec 01, 2017, 01:18pm
bucky bucky is offline
Official Forum Member
 
Join Date: Jan 2011
Posts: 1,038
Quote:
Originally Posted by jTheUmp View Post

Depends on if you're storing the values as a String (characters) or as an Integer (number).

Computers store everything in binary, as a combination of 1s and 0s. Assuming we're using 8-bit notation (that is, 8 slots per number) if we're storing just Integers, there's no difference between 0 and 00, because they're both stored as 00000000. 1 is stored as 00000001, 2 is stored as 00000010, 3 is stored as 00000011, 4 is stored as 00000100, etc... 11 is stored as 00001011.

String values are handled differently... each "letter" has it's own 8-bit value. Assuming we're using ASCII notation, the 8-bit value for 0 is 00110000, which would be repeated twice for 00, so 0011000000110000. 11 would be 0011000100110001.

Of course, there are many different types of character encoding schemes (UTF-8, UTF-16, UTF-32, ISO8859, Windows 1252, and many many more, all of them work similarly to ASCII, but the actual binary value of a particular character may be different)



You may commence shouting "Shut Up, Nerd!" at me at your earliest convenience.
Perfect, perfect, perfect! I almost spewed Mt. Dew on my 4 monitors. I was shouting "Go on, please continue!" although it was at a later convenience, not the earliest.

https://en.wikipedia.org/wiki/Computer_number_format
__________________
If some rules are never enforced, then why do they exist?
Reply With Quote