Number Bases In today’s lesson we will look at: what we mean by a number base how ordinary numbers work a number system called binary why binary is useful other bases
What is a Number Base? A number base is a method for writing down numbers For example, we normally use a number system called base 10 (also sometimes called denary or decimal), which is all based on the number 10 Some people think that we developed a number system based on tens because we have ten fingers You might also know other number systems, e.g. roman numerals or tallies (as used in tally charts) We are only talking about how numbers are written down – this doesn’t change the way numbers work
The Decimal System The number system most of us use is based on tens: x10 As we move left, the column headings increase by a factor of ten In each column we can have ten different digits (1 to 9 and 0) This number is: 1 x x x x 1 That gives us one thousand two hundred and thirty four
Binary The binary system is the same, but is based on two: x2 As we move left, the column headings increase by a factor of two In each column we can have two different digits (0 or 1) This number is: = 11 It’s still eleven, it’s just written down differently
Why Use Binary? Computers haven’t got fingers, but they have got circuits that can be on or off We can use on to represent 1 and off to represent 0 and use these circuits to process binary numbers Everything inside the computer, therefore, is done in the form of binary Binary numbers can be sent along cables as pulses of electricity (where a pulse would be 1, and a gap is 0) If you used your hands to count using binary (finger up = 1, down = 0), you could count up to 1023 on your ten fingers!
Anything Else? You might have noticed that lots of numbers to do with computers are multiples of 2 – e.g. you can get iPods with 8Gb, 16Gb, 32Gb, etc, of storage, rather than 10Gb, 20Gb, 30Gb, etc. Numbering things with multiples of two (1, 2, 4, 8, 16, etc.), rather than sequentially (1, 2, 3, 4, 5), gives them an interesting property… …any given combination gives a unique total that can only come from that one combination This can be used to create things called binary flags
Other Bases Hexadecimal is sometimes used; it’s based on sixteens: x16 As we move left, the column headings increase by a factor of sixteen In each column we can have sixteen different digits This number is: 1 x x x 1 = 291 It’s still two hundred and ninety- one, it’s just written down differently
Wait a Minute... How can there be sixteen possible digits in each column, when there are only ten digits? Hexadecimal uses the digits 0-9 and the letters A-F, so counting would look like this: ABCDEF ABCDEF A1B1C1D1E1F A2B2C2D2E2F …etc
Why Use Hexadecimal? Hexadecimal numbers are shorter than their decimal equivalents, and use fewer digits. For example, a two digit number can be up to FF, which is 255 Hexadecimal is most often used to describe colours, especially when editing a web-page or adjusting the palette in your painting program Colour codes are made up of two digits each for the amount of red, green and blue, in the form #RRGGBB e.g. #FF0000 is bright red, #FF00FF is purple, etc.