Lecture 2
Lecture 2
Lecture 2
Number Systems
numbers.
25 24 23 22 21 20
32 16 8 4 2 1
1 1 1 0 0 1
Answer = 111001
The Hashemite University 16
Fraction Decimal to Binary
As for integers, for fraction decimal numbers there are
two methods:
1-Repeated Multiplication By 2
For this method, multiply the decimal number by 2,
If the integer part of the result is 0, on the right side write
down a 0.
If the integer part of the result is 1, write down a 1.
Then remove the integer part from the result and repeat the
Answer = 0.010011...
The Hashemite University 18
Fraction Decimal to Binary –
Second Method
2- Sum on the fly
List the powers of 2 starting from -1 power.
See which of these powers must be included in
the sum that will have the result of the decimal
number that you want to convert.
These powers will have 1 in its position and the
powers that are not used will have 0.
This method is suitable for small to mid size
numbers.
0 1 1 0 0 0
Answer = 0.011
The Hashemite University 20
Notes
The same methods used to convert from
decimal (integer or fraction) to binary are
used to convert from decimal to any other
base. Just change the radix or base value
that you use in the multiplication or in the
division.
When you face a number that have both
integer and fraction parts, e.g. 107.82 or
1011.11011, convert each part alone and
then combine them.
2 2 6 5 7 . 5 7 48
Answer = 22657.5748
The Hashemite University 26
Octal to Binary Conversion
Just repeat the inverse of the process used to
convert from binary to octal.
In other words, substitute each octal digit
with its 3 bit binary equivalent.
Example: convert 567.428 to binary.
5 6 7 . 4 28
Answer = 1276628
The Hashemite University 30
Fraction Decimal to Octal
Conversion
Repeated Multiplication By 8
For this method, multiply the decimal number by 8.
Write down the integer part of the result.
Then remove the integer part from the result and repeat the
Answer = 0.266213...8
The Hashemite University 32
Conversion Between Binary
and Hexadecimal
The Hexa has a base = 16 which 2
raised to power 4. In other words, each
digit in the hexa system can substitute
for 4 bits in the binary system.
Similar to octal, such observation is
utilized in the conversion process
between hexa and binary.
2 5 A F . B E 16
Answer = 25AF.BE16
The Hashemite University 35
Hexa to Binary Conversion
Just repeat the inverse of the process used to
convert from binary to hexa.
In other words, substitute each hexa digit
with its 4 bit binary equivalent.
Example: convert 56D.4216 to binary.
5 6 D . 4 216
Then remove the integer part from the result and repeat the
Answer = 0.5B22D0...16
The Hashemite University 41
Conversion Between Octal and
Hexadecimal
From octal to hexadecimal:
First convert from octal to binary then
convert the result from binary to
hexadecimal.
From hexadecimal to octal:
First convert from hexa to binary then
convert the result from binary to octal.