An introduction to computers and computer systems
An introduction to computers and computer systems

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

6 Representing numbers in binary

Now looking at the encoding for numerals in Table 2, we can see how the characters 0–9 are represented in UTF-8.

Table 2 ASCII table for numerals
Binary code Character
0011 0000 0
0011 0001 1
0011 0010 2
0011 0011 3
0011 0100 4
0011 0101 5
0011 0110 6
0011 0111 7
0011 1000 8
0011 1001 9

Note, this is the character representation of the number to display that number on a screen or to print in a document. It is not the actual representation that a processor will use when preforming numerical calculations!

Consider the number ‘11’. To print this number we use two characters, a ‘1’ followed by another ‘1’. However, this is a very inefficient way for a processor to handle numbers in a calculation. Instead, the number eleven can be simply encoded in a byte as 00001011. That is one byte, not two, and in a form that instructions such as add and subtract can be directly applied to the bits for efficient calculations. There are other special ways to encode numbers for processing. They are beyond the scope of this course.

Modern computer programming languages such as Python handle the conversion between the two representations of a number automatically. However, in many languages it is for the programmer to declare in the program whether a number is to be used say for printing on a report, or for calculating the values to be printed.

The logic of the program informs the processor how to handle each byte, whether it represents a character or a number, or even another data format altogether as you shall see in the next section.

Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to University-level study, we offer two introductory routes to our qualifications. You could either choose to start with an Access module, or a module which allows you to count your previous learning towards an Open University qualification. Read our guide on Where to take your learning next for more information.

Not ready for formal University study? Then browse over 1000 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus371