# Falk Joensson'sLearning Programming with Eas(Easy Application Script Tutorial)

## How the Computer Works:04. To Bytes and Beyond

Each bit carries only a single yes-or-no information, such as "Is the A key pressed?". Most I/O devices, however, use signals that can have a wide range of values, like the brightness of a pixel on the monitor, or the movements of microphone and speaker membranes. Using a group of bits together, where each bit serves as a binary digit, you can create numbers to represent such signals. Using one bit: bit 0 = number 0 bit 1 = number 1 Using two bits: two bits 00 = number 0 two bits 01 = number 1 two bits 10 = number 2 two bits 11 = number 3 Using three bits: three bits 000 = number 0 three bits 001 = number 1 three bits 010 = number 2 three bits 011 = number 3 three bits 100 = number 4 three bits 101 = number 5 three bits 110 = number 6 three bits 111 = number 7 Each additional bit doubles the range of numbers. It repeats the prior range first completely with the leading bit set to 0, then again with the leading bit set to 1 and its 2^(n-1) value added. (100=4 is 000=0 + 4, 101=5 is 001=1 + 4, 110=6 is 010=2 + 4, 111=7 is 011=3 + 4.) With B as the number of bits, you can create B^2 different numbers: 1 bit: 0..1 (2 numbers) 2 bits: 0..3 (4 numbers) 3 bits: 0..7 (8 numbers) 4 bits: 0..15 (16 numbers) 5 bits: 0..31 (32 numbers) 6 bits: 0..63 (64 numbers) 7 bits: 0..127 (128 numbers) Early computers used 7 bits a lot, because this offers a range that is enough to represent a percentage value, and it also allowed for storing text files, which needs 26 letters both in lowercase and uppercase, 10 digits (together 2×26+10=62 characters) and several further characters such as space, . ! ? , ; : " - ( ), a line break and so on. Soon one further bit was added to create with 8 bits: 0..255 (256 numbers) the basic memory unit used by computers, named the byte, which can conveniently be written as a 2-digit hexadecimal number and has enough values (256) to cover many practical I/O and calculation needs. From then on, when more precise numbers or bigger numbers were needed, one did not add further bits, but rather used whole groups of bytes together. A group of two bytes was called a word (as 256×256 = 65,536, enough to cover even a very thorough dictionary of the English language), and two words (= more than 4 billion numbers!) was called a "double word". Various mathematical innovations allowed for Byte-based numbers being used optionally in a signed interpretation, for instance a signed byte does not represent 0..255 but -128..+127, and even in a scientific exponent notation, where floating-point numbers are written as m×10^x, with m and x being stored as signed bytes, words or double words in the computer.
04. To Bytes and Beyond