Unit 1 - Representing Data
The binary number system is a special code that the computer uses for representing numeric data. Numeric data is any value that can be used for mathematical operations such as addition and subtraction. This code is completely different than the ASCII system, except that only 1s and 0s are used.
For example, consider the code 01001010. In the ASCII system, this represents the letter “J”. However, in the binary number system, this represents the number 74.
To understand how the binary
number system works, we can compare it to the number system that we use
every day – the decimal number system. The decimal number system is
sometimes known as Base 10, since each of the digits in a number
represents a “10s” column. Each column has a value that is 10 times more
than the value of the column on it’s right. For example, the figure
below shows the column breakdown for the decimal number 6,825:
However, in the binary number system, each of the digits in a number represents a “2s” column instead of a 10s column. As a result, binary numbers are sometimes called Base 2 numbers.
In a binary number, each column has a value that is 2 times more than
the value of the column on it’s right. For example the following figure
shows the column breakdown for the binary number 1101:
Adding the results, we get 8 + 4 + 0 + 1 = 13. Therefore, the computer stores the number 13 as a binary code of 1101.
Formatting Binary Numbers
Binary numbers are usually written with a subscript of "2" so that they are not confused with decimal numbers. For example, 1101 could mean a binary 13, or it could mean a decimal one thousand, one hundred and one. Therefore, the binary number would be written as 11012. Similarly, it is good practice to write a subscript of "10" beside decimal numbers (for example, 1310 to represent thirteen base 10).
Large binary numbers are often written by grouping every 4 digits together. This is only done for ease of reading (similar to using a comma to separate every 3rd digit in a decimal number).
For example, consider the 32-bit binary number
This would be much easier to read (and enter into a calculator) if it was written in groups of 4:
0101 1001 1100 0100 1111 0010 1000 10102