02Binary

advertisement
0.2 Binary Numbers
In preparation for the detailed study of computer arithmetic, we need to understand the binary number
system. Decimal numbers are converted from base 10 to base 2 in order to store numbers on a
computer and to simplify computer operations like addition and multiplication.

The decimal system
(427.325)10 = 4 ´ 102 + 2 ´ 101 + 7 ´ 100 + 3´ 10-1 + 2 ´ 10-2 + 5 ´ 10-5
The expression on the right contains power of 10 together the digits 0,1,2,3,4,5,6,7,8,9 . If
we admit the possibility of having an infinite number of digits to the right of the decimal point, the
any real number can be expressed in the manner just illustrated, with a sign ( + or - ) affixed to it.
Thus, for example, -p is
-p = -3.1415926535897932846264338
The last 8 written here stands for 8 ´ 10-26 .

The binary system
Only the two digits 0 and 1 are used. A typical number in the binary system can also be written
out in detail; for example
(1001.11101)
2
= 1´ 23 + 0 ´ 22 + 0 ´ 21 + 1´ 20 + 1´ 2-1 + 1´ 2-2 + 1´ 2-3 + 0 ´ 2-4 + 1´ 2-5
= (9.90625)10
This is the same real number as (9.90625)10 in decimal notation.
In general, binary numbers are expressed as
… b2b1b0·b-1b-2… ,
where each binary digit, or bit, is 0 or 1. The base 10 equivalent to the number is
… b2 22 + b1 21 + b0 20 + b-1 2-1 + b-2 2-2 …

Decimal to Binary
To convert decimal to binary, it is simple to break the number into integer and fractional parts and
convert each part separately.
Example:

(53.7)10 = (?)2
Binary to Decimal
To convert a binary number to decimal, it is again best to separate into integer and fractional
parts.
Example:
(110101.1011)2 = ?
(
)
Example: 0.1011
(
Example: 0.10110
)
2
2
=?
=?
Download