
Sorry, this is not a post about tandems, but about the power of 2, binary numbers, the number 256, and some other geeky stuff!
Binary – base 2 – is very important in computers as it provides the counting and coding scheme for storing and manipulating all digital information, not just numbers themselves but all the letters, special characters, and more complex data (pictures, sound, program instructions etc.) – in fact all information used in Information Technology.
Here is a short primer on how that magic happens.
A bit of math(s)
Raising a number to the power of is called exponentiation. The base number we are interested in here is 2 rather than 10 (denary) which is what we humans count with, and luckily the number of fingers and toes we normally have.
(Ed. OK you know that’s not a coincidence don’t you?!)
Listed below are the exponents ’n’ for 2n with n from 0 to 10. When we talk about exponential growth, this is what we mean, although higher bases* can be seen to grow more quickly remember the rice and chess board story, explained here and more visually here.
20 = 1 (always ‘1’ for any base)
21 = 2 (always the same as the base integer)
22 = 4 (2×2)
23 = 8 (2x2x2)
24 = 16 (2x2x2x2)
25 = 32 (you see the pattern?)
26 = 64
27 = 128
28 = 256
29 = 512
210 = 1024
etc.
Higher orders above 210 (otherwise known as 1K is a binary thousand) uses the shorthand prefix ‘kilo-‘, and then up to and then mega- and giga- tera- etc. are the common currency when referring to computer memory and data transmission speeds.
(*base 16, hexadecimal or ‘hex’ for short is also used quite a lot in computing, but it all boils down to base 2 in the end as 16 = 24)
But what does this mean for computers? Digital computers only store and manipulate information, or more correctly data, in binary states (1 or zero, on or off, higher voltage or lower voltage, magnetism in one of 2 different directions etc.) so a single binary-digit or bit can be 1 or 0. With 8 bits of storage strung together, called a byte, there are 256 possible states that a byte can represent, i.e. 0 to 255
00000000, 00000001, 00000010, 00000011 … 11111101, 11111110, 11111111
I am not a number!
(well actually you are; not just your age and vital statistics, but you name, address and everything else can be coded as a number)
Going back to our byte of storage; 256 may not sound like a lot, but it allows for coding of numbers, letters (in lower and upper cases and some accented versions), punctation and symbols (called collectively special characters) and a few more command and control-type characters. By coding I mean associating a number (string of 1’s and 0’s’) to each character. One such system is Unicode:
Unicode is a computing industry standard for the consistent encoding, representation, and handling of text expressed in most of the world’s writing systems.
https://en.wikipedia.org/wiki/Unicode
https://en.wikipedia.org/wiki/List_of_Unicode_characters
Unicode incorporates* some older standards, including ones that I used as a programmer back in the day; ASCII (American Standard Code for Information Interchange or “ass-key” for short!) which extended earlier telegraph codes, and EBCDIC (Extended Binary Coded Decimal Interchange Code or “eb-cee-dic”) an IBM standard which evolved from punch(ed) cards, an early computer input and storage technology.
(*This means either backwards compatible in the case of ASCII or via a transformation table for EDCDIC)
That’s as far as I want to go into this very complicated subject! Here are some extracts of coding table UTF-8 (8 bits) for Latin script, which covers the English-speaking and -writing world, and a lot-more besides (see map below). Note that ‘1’ is not stored as ‘00000001’ but as ’49’ (hex 31), which always confused me!
256 and all that
As an historical and practical consequence of the byte length, the number ‘256’ crops up quite a bit in computing and gaming. You may have seen 256 Kbps (Kilo Bytes per Second internet/transmission speed) or 256 MB (Megabytes storage capacity), or similar, and now you know where the multiplier comes from. And also:
- In the original Legend of Zelda the main character was limited to carrying 255 rupees (the currency of the game) at any given time
- In the video game Pac-Man famously has a kill screen, when things can start to go wrong, at level 256
- In earlier versions of Microsoft Excel, the maximum number of columns was 256
- And, the maximum number of colours available in a GIF
- etc.
I hope you found this primer useful? In later posts I want to explore some deeper aspects of computer science and programming, and also look at the keyboard and special characters in more detail. Watch this space.
IT Chemist
(c) 2019 IT elementary school Ltd.
Leave a Reply