An integer is a whole number. It may be positive or negative. Ordinary numbers are called real numbers. This includes all integers and all numbers with a decimal point.
There are various ways in which integers can be represented using 1s and 0s.
The binary notation is a method of representing numbers using 1s and 0s (Fig 1), In a binary number each 1 represents a power of 2. The powers of two are the numbers 1, 2, 4, 8, 16, etc. (see Fig 2).
Decimal number | Binary equivalent |
0 | 0 |
1 | 1 |
2 | 10 |
3 | 11 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
8 | 1000 |
9 | 1001 |
Fig 1 Binary values for 0 to 9
In the binary integer 110111, working from the left, the Is represent a 32, a 16, a 4, a 2 and a 1 (the zero indicates there is no 8).
The number is equal to (in decimal) 32+16+4+2+1=55.
If a small binary number is represented in a long storage location, the digits at the left are made zero.
Express the decimal numbers 7 and 5 as six-bit binary numbers.
710=0001112
510=0001012
Note: A suffix is used to indicate the base or radix of the numbers-10 for decimal, 2 for binary.
Advantages of the binary system:
1- A binary digit has only two possible states, 0 or 1, and so is easy to represent using electrical or magnetic devices.
2- The instructions and circuitry necessary to make a machine carry out arithmetic operations in binary are very simple.
Disadvantages of the binary system:
1- Numbers represented in binary have a larger number of digits.
2- Binary numbers are difficult to write down accurately and to remember.
Labels: Computer