Sie sind auf Seite 1von 23

1

CHAPTER

NUMBER SYSTEMS
OBJECTIVES
At the end of this chapter, students should be able to :

understand how integers and fractional numbers are represented in binary

explore the relationship between decimal number system and number systems of
other bases (binary, octal, hexadecimal)

understand signed numbers and unsigned numbers

understand number representations in twos complement

perform arithmetic operations in every base

understand the method of floating point number representation in IEEE format

2.0

INTRODUCTION

This chapter emphasizes on the number systems in decimal (base 10), binary (base 2), octal
(base 8) and hexadecimal (base 16).
One of the important characters in numbering systems is the positional notation in every digit
within a number and the base being used. Every position of a digit contains a permanent
value. Comparisons of every digit among different bases are shown in the following table:
BASE

5th place

PLACE
1st
Single
place
unit
101
100
10
1

decimal

105
100,000

4th
place
104
10,000

3rd
place
103
1,000

2nd
place
102
100

24
16

23
8

22
4

21
2

20
1

binary

25
32
85
32,768

84
4,096

83
512

82
64

81
8

80
1

octal

hexadecimal

16
1,048,576

16
65,536

16
4,096

16
256

16
16

16
1

1st
place
10-1
0.1
1/10
2-1
0.5
1/2
8-1
0.125
1/8
16-1
0.0625
1/16

1.1

2nd place

3rd place

10-2
0.01
1/100
2-2
0.25
1/4
8-2
0.015625

10-3
0.001
1/1000
2-3
0.125
1/8
8-3
1.953125
X 103
1/512
16-3
2.4414062
X 104
1/4096

1/64
16-2
3.906 X
103
1/256

PERFORMING ARITHMETIC OPERATIONS IN DIFFERENT


NUMBER BASES

The following table shows the equivalent values for decimal numbers in binary, octal
and hexadecimal:

2.1.1

Decimal

Binary

Octal

Hexadecimal

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

0
1
2
3
4
5
6
7
10
11
12
13
14
15
16
17

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

Addition And Subtraction of Binary Numbers


Example 1:
11111

1011 1100
+ 1100 1111
1 1000 1011
Example 2:
11

2.1.2

1001
11
0110

Addition And Subtraction of Octal Numbers


Example 3:
1 1 1

333
+ 476
1031

3 + 6 = 9 => 11
3 + 7 = 10 + 1 = 11 => 13
3 + 4 = 7 + 1 = 8 => 10

Example 4:
618

723
- 536
165

3 - 6 => 8 + 3 - 6 = 5
1 3 => 8 + 1 3 = 6
65=1

2.1.3

Addition And Subtraction of Hexadecimal Numbers


Example 5:
1A2 3
+ 7C28
964B

3 + 8 = 11 = B
2+2=4
A + C = 10 + 12 = 22 16 = 6 with carry 1
1+7+1=9

Example 6:
E 15 15

1F00A
B2
1EF58

A 2 = 10 2 = 8
0 B = 16 11 = 5
0 -> 16 1 = 15 = F
F1=E
1 -> 1

EXERCISE
1.

Perform the addition and subtraction for the following binary numbers:
a)
b)
c)

2.

d)
e)
f)

10001011 100111
11000 1111
1100110 111010

Perform the addition and subtraction for the following octal numbers:
a)
b)
c)

3.

10 + 111010
1000 + 1011
10011100 + 10111

677 + 2356
45 + 47
4007 + 112377

d)
e)
f)

673 - 25
6006 - 7
4510 - 571

Perform the addition and subtraction for the following hexadecimal numbers:
a)
b)
c)

B677 + CE79
21BA + ADD
9A3B + FACE

d)
e)
f)

A5 - 17
7AC - 3B1
FA51 - A76

2.2

NUMERIC CONVERSION BETWEEN NUMBER BASES

2.2.1 Conversion of decimal to binary


Example 7:
Convert 3710 to binary.
Steps:
37 2
18 2
92
42
22
12

=
=
=
=
=
=

18
9
4
2
1
0

balance
balance
balance
balance
balance
balance

1
0
1
0
0
1

(LSB)

(MSB)

Therefore , 3710 = 1001012


Example 8:
What is the value of 37.687510 in binary?
37 . 6875 is a decimal number with decimal points.
integer decimal point

Steps:
1.
2.

Convert the integer to binary by using method shown in Example 1.


Convert the decimal point to binary by using the following method.
0.6875
X
2
The 1 is saved as
result, then dropped
(MSB)
1.3750
and the process
1
X
2
repeated
0
0.7500
X
2
1
1.5000
X
2
(LSB)
1
1.0000

So, (0.6875)10 = (0.1011)2

Therefore,

37.687510 = 100101.10112

2.2.2

Conversion of binary to decimal


Example 9:
Convert 1001102 to decimal.
Steps:
1001102
= (1 X 25) + (0 X 24) +(0 X 23) +(1 X 22) + (1 X 21) + (0 X 20)
= 32 + 0 + 0 + 4 + 2 + 0
= 3810
Therefore,

1001102 = 3810

Example 10:
Convert 100110.11012 to decimal.
0.10112
= (1 X 2-1) + (1 X 2-2) + (0 X 2-3) + (1 X 2-4)
= 1/2 + 1/4 + 0 + 1/16
= (13/16)10 or 0.812510
From Example 9, 1001102 = 3810
Therefore, 100110.10112 = 38.812510

2.2.3

Conversion of octal to decimal


Example 11:
Convert 5638 to decimal.
Steps:
5638
= (5 X 82) + (6 X 81) + (3 X 80)
= 320 + 48 + 3
= 37110
Therefore,

5638 = 37110

Example 12:
Convert 563.28 to decimal.
Steps:
563.28
= (5 X 82) + (6 X 81) + (3 X 80) + (2 X 8-1)
= 371 + (2 X 1/8)
= 371 + 1/4
= 371.2510
Therefore,

563.28 = 371.2510

2.2.4

Conversion of decimal to hexadecimal


Example 13:
Convert 2110 to hexadecimal.
Steps:
21 16
1 16

=
=

1 balance 5
0 balance 1

(LSB)
(MSB)

Therefore , 2110 = 1516


Example 14:
Convert 21.2510 to hexadecimal.
Steps:
From Example 7,
21 2
=
10 2
=
52
=
22
=
12
=

10
5
2
1
0

So, 2110 = 101012


Now,

balance
balance
balance
balance
balance

1
0
1
0
1

(LSB)

(MSB)

0.25
X 2

(MSB)

0.50
X 2

(LSB)

1.00

So, (0.25)10 = (0.01)2

Therefore,
21.2510
= 10101 . 01002
= 15.416

Refer to conversion of
binary to hexadecimal

2.2.5

Conversion of hexadecimal to decimal


Example 15:
Convert E516 to decimal.
Steps:
E516
= (E X 161) + (5 X 160)
= (14 X 16) + (5 X 1)
= 224 + 5
= 22910
Therefore, E516 = 22910
Example 16:
Convert E5.A816 to decimal.
Steps:
Firstly convert the number into binary,
Hex
E 5 . A 816
Binary
1110 0101 . 1010 10002
From Example 15, E516 = 22910
Now,
(0.1010 1000)2
= (1 X 2-1) + (0 X 2-2) + (1 X 2-3) + (0 X 2-4) + (1 X 2-5) +
(0 X 2-6) + (0 X 2-7) + (0 X 2-8)
= 1/2 + 1/23 + 1/25
= 1/2 + 1/8 + 1/32
= 0.5 + 0.125 + 0.03125
= (0.65625)10
Therefore,

2.2.6

E5.A816 = 229.6562510

Conversion of hexadecimal to binary


Method:
Get the binary representation for every digit in the hexadecimal number.
Example 17:
Convert F116 to binary.
F116 =

1111

00012

Example 18:
Convert 95AD16 to binary.
95AD16 =

1001

0101

1010

11012

2.2.7

Conversion of binary to hexadecimal


Example 19:
Convert 111001110101112 to hexadecimal.
Group the binary number by fours from right to left.
0011 1001 1101 01112
3
9
D
716

2.2.8

Conversion of binary to octal


Example 20:
Convert the binary number in Example 13 to octal.
Group the binary number by threes from right to left.

2.2.9

011

100

111

010

1112
78

Conversion of hexadecimal to binary and octal to binary


Example 21:
Convert 1995.AB16 to binary and octal.
Hex

Binary

0001

1001

1001

0101

Octal

.
.

1010

1011

Example 22:
Convert 101111111000011.1101111001102 to hexadecimal and octal.
Hex
Binary
Octal

0101

1111

1100

0011

.
.
.

1101

1110

0110

Example 23:
The following shows the number representations for 2003 in binary, octal and
hexadecimal.

10

Decimal

200310
= (2 X 103) + (0 X 102) + (0 X 101) + (3 X 100)
= 2000 + 0 + 0 + 3
= 200310

Binary

1111 1010 0112


= (1 X 210) + (1 X 29) + (1 X 28) + (1 X 27) +
(1 X
26) + (0 X 25) + (1 X 24) + (0 X 23) +
(0 X 22) +
(1 X 21) + (1 X 20)
= 1024 + 512 + 256 + 128 + 64 + 0 + 16 + 0 + 0 + 2 +
1
= 200310
37238
= (3 X 83) + (7 X 82) + (2 X 81) + (3 X 80)
= 1536 + 448 + 16 + 3
= 200310

Octal

Hexadecimal

7D316
= (7 X 162) + (13 X 161) + (3 X 160)
= 1792 + 208 + 3 = 200310

EXERCISE
1.

Convert the following decimal numbers to binary, octal and hexadecimal:


a)
12
c)
119
b)
57
d)
203

2.

Convert the following binary numbers to decimal, octal and hexadecimal:


a)
10010011
c)
00110110
b)
00101101
d)
10111001

3.

Convert the following octal numbers to binary and decimal:


a)
43
c)
71
b)
66
d)
82

4.

Convert the following hexadecimal numbers to binary and decimal:


a)
171
c)
FADE
b)
AC3
d)
CACA

5.

Convert the following numbers to the number of other bases respectively:


No.
(a)
(b)
(c)
(d)

Decimal
1234

Binary

Octal

Hexadecimal

10110111
73
6FDA

11

6.

Find the binary representation for:

a)
b)
7.

43.62510

13.58
31.068

e)
f)

1A.3B16

e)
f)

CA.F116

BC.0116

Convert the following numbers to decimal:

a)
b)
2.3

c)
d)

13.43510

1101.1012
1001.011012

c)
d)

73.128
41.038

6E.A316

THE ALPHANUMBERIC REPRESENTATION


The data entered as characters, number digits, and punctuation are known as
alphanumeric data. Three alphanumeric codes are in common use. The three
codes are known as ASCII (American Standard Code for Information Interchange),
Unicode and EBCDIC (Extended Binary Coded Decimal Interchange Code). The
following tables show the comparisons between the ASCII code in binary and
hexadecimal for the given characters.
Character

Binary

Hex

Character

Binary

Hex

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z

100 0001
100 0010
100 0011
100 0100
100 0101
100 0110
100 0111
100 1000
100 1001
100 1010
100 1011
100 1100
100 1101
100 1110
100 1111
101 0000
101 0001
101 0010
101 0011
101 0100
101 0101
101 0110
101 0111
101 1000
101 1001
101 1010

41
42
43
44
45
46
47
48
49
4A
4B
4C
4D
4E
4F
50
51
52
53
54
55
56
57
58
59
5A

0
1
2
3
4
5
6
7
8
9

011 0000
011 0001
011 0010
011 0011
011 0100
011 0101
011 0110
011 0111
011 1000
011 1001

30
31
32
33
34
35
36
37
38
39

Space
Full stop
(
+
$
*
)
/
Comma
=

010 0000
010 1110
010 1000
010 1011
010 0100
010 1010
010 1101
010 1111
010 1100
010 1100
011 1101

20
2E
28
2B
24
2A
29
2D
2F
2C
3D

12

13

2.4

THE DECIMAL REPRESENTATION


BCD (Binary Coded Decimal) is often used to represent decimal number in
binary.
Decimal
0
1
2
3
4
5
6
7
8
9

2.5

BCD
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001

For example, the decimal value of 98 is


represented in BCD as 1001 1000BCD.
But in binary, 9810 = 11000102
Method:
2
98
balance 0
(LSB)
2
49
balance 1
2
24
balance 0
2
12
balance 0
2
6
balance 0
2
3
balance 1
2
1
balance 1
(MSB)

UNSIGNED NUMBERS
Unsigned numbers are numbers without signs. In other words, they are
numbers with only positive values. An 8-bit storage location can store any
unsigned integer of value between 0 and 255, a 16-bit storage location 0-65535.
The numbers that have been discussed before are all unsigned numbers.

2.6

REPRESENTATIONS FOR SIGNED NUMBERS


As shown in previous examples, unsigned integers can be converted directly
to binary numbers and processed without any special care. The addition of a sign
complicates the problem. There are several different ways used to represent
negative numbers in binary form, depending on the processing that is to take
place. There are:
a)
Sign-and-magnitude representation
b)
1s complement representation
c)
2s complement representation (the most common)

2.6.1

Sign-And-Magnitude Representation
In daily usage, signed integers are represented by a plus or minus sign and
a value. This representation is known as sign-and-magnitude representation. A
sign cannot be used in the computer, but the uses of 0s and 1s take place. The
leftmost bit in a binary number is considered the sign bit. The remaining (n-1)
bits are used for the magnitude. A 0 sign bit represents a plus (positive) sign and
a 1 represents a minus (negative).
Example 24:

0100101
+
-

37
1100101
37

Example 25:

0000000000000001
(+1)

0111111111111111
(+32767)

1000000000000001
(-1)

1111111111111111
(-32767)

14

What is the sign-and-magnitude representation of the decimal numbers 31 and


+31 if the basic unit is a byte?
Since the number +31 is positive, the sign bit is set to 0. The remaining 7 bits will
be used to represent the magnitude.
The binary representation of decimal 31 is given by the following sequence
0011111. That is, 3110 = 00111112.
The sign-and-magnitude representation of the number is 000111112.
To represent the sign-and-magnitude of 31, the sign bit is changed from 0 to 1.
Since the binary representation in its magnitude is the same, therefore, the signand-magnitude of 31 is 100111112

15

Example 26:
What is the decimal equivalent value of the sign-and-magnitude binary sequence
10111001?
The number is negative since its sign (the leftmost bit) is 1.
The magnitude of the number is given by the sequence of bits 0111001.
Now,
01110012 = (1 X 25) + (1 X 24) + (1 X 23) + (1 X 20)
= 32 + 16 + 8 + 1
= 57
Therefore , the decimal equivalent of the number 10111001 represented in
sign-and-magnitude is 57.
Addition of two numbers in sign-and-magnitude is carried out using the usual
conventions of binary arithmetic. However, if both numbers have the same sign,
the magnitude are added and the same sign is copied. If the signs are different,
the number that has the smaller magnitude is subtracted from the larger one.
If given n bits, in sign-and-magnitude representation, the range of numbers
that can be represented varies from 2n+1 + 2n-1 1. Therefore, if the result of an
arithmetic operation falls outside the range, the operation causes an overflow.
Example 27:
What is the decimal value of the sum of the binary numbers 10110011 and
00010110 if they are represented in sign-and-magnitude? Assume that the
basic unit is the byte.
Notice that the numbers have different signs: 10110011 is negative and
00010110 is positive.
To calculate their sum, it is necessary to find out which of these two numbers
has the larger magnitude.
Now,
Number :
Sign :
Magnitude :

Decimal
value

10110011
1 (negative)
0110011
= (1 X 25) + (1 X 24) +
(1 X 21) + (1 X 20)
= 32 + 16 + 2 + 1
= 51
-51

Number :
Sign :
Magnitude :

Decimal
value

00100110
0 (positive)
0100110
= (1 X 25) + (1 X 22)
+ (1 X 21)
= 32 + 4 + 2
= 38
+38

Value with the largest magnitude: 51 since 51 > 38.


Sign of the difference: negative (sign of the number with the larger
numerical value)
Numerical value of the difference: 13 (51 38 = 13)
Therefore, the decimal value of the sum is 13.
2.6.2

The Ones Complement Convention

16

In base 2, the largest digit is 1. The 1s complement of a number is performed


simply by changing every 0 to a 1 and every 1 to a 0. This exchange of 0s
and 1s is also known as inversion.
2.6.3

The Twos Complement Convention


The twos complement convention or 2s complement is the most popular
among computer manufacturers since it does not present any of the problems of
the sign-and-magnitude or ones complement.
Positive numbers are represented using a similar procedure to that of the
sign-and-magnitude. Given n bits, the range of numbers that can be represented
in twos complement is 2n+1 to 2n-1 1. Notice that the range of negative numbers
is one larger than the range of the positive values.
0111 1111
(127)
(2n-1 1)

0000 0000
(0)

1111 1111
(-1)

1000 0000
(-128)
-(2n-1)

To represent a negative number in this convention, follow the three-step


process shown below:
Step 1:
Step 2:

Step 3:

Express the absolute value of the number in binary.


Change (negate) all zeros to ones and all ones to zeros in the
binary number obtained in the previous step. This process is
called complementing the bits and also known as 1s
complement.
Add one to the binary number of step 2.

Example 28:
What is the 2s complement representation of 23?
Step 1:
Step 2:
Step 3:

The absolute value of the number is 23.


2310 = 000101112
Change all zeros to ones and vice versa,
= 11101000 (1s complement)
Add 1,
11101000
+
1
11101001

Therefore, the 2s complement representation for 23 is 11101001. Notice


that the sign of the result is 1 as it should be.

17

Example 29:
What is the decimal positive value of the 2s complement number 11100011?
Follow steps 2 and 3 from the previous procedure since the number is negative:
Step 2:

Complement all bits of the given number,


= 00011100 (1s complement)
Add 1,
00011100
+
1
00011101

Step 3:

Therefore, the positive counterpart of 11100011 is 00011101.


The value of 000111012 = (1 X 24) + (1 X 23) + (1 X 22) + (1 X 20)
= 16 + 8 + 4 + 1
= 2910.
Thus, the decimal positive counterpart of the given number is 29.
2.6.3.1

The Arithmetic Operation In Twos Complement


Example 30:
Perform the following operation in 8-bit 2s complement.
i)

13 + 31
13
31
44

ii)

0000 1101
0001 1111
0010 1100

21 5
510 = 0000 01012
1111 1010 (1s complement)
+
1
1111 1011 (2s complement)
21
0001 0101
-5
+
1111 1011
16
1 0001 0000
carry is discarded

iii)

EXERCISE

9 15
1510 = 0000 11112
1111 0000 (1s complement)
+
1
1111 0001 (2s complement)
9
0000 1001
-15 + 1111 0001
-6
1111 1010

18

1.

Convert the following binary numbers to decimal if they are represented in signand-magnitude:
a)
10001101
d)
11001010
b)
01100101
e)
01011001
c)
00011011
f)
103

2.

Convert the following numbers to binary:


a)
-71
c)
117
b)
-121
d)
93
c)
-95
e)
103

3.

Convert the following numbers to binary if they are represented in sign-andmagnitude, 1s complement and 2s complement:
No.
Decimal
Sign-and-Magnitude
1s
2s
complement
Complement
(a)
-12
(b)
-37
(c)
-59
(d)
-112

4.

What is the decimal value of the sum of the binary numbers 11101101 and
01001010 if they are represented in sign-and-magnitude? Assume that the
basic unit is the byte.

5.

By using the 2s complement method, perform the subtraction operation for the
followings:
a)
53
d)
57 63
b)
47
e)
61 27
c)
35 46
f)
13 104

19

2.9

THE IEEE FLOATING POINT REPRESENTATION


There are two problems with integers; they cannot express fractions, and the
range of the number is limited to the number of bits used. An efficient way of
storing fractions is called the floating point method, which involves splitting the
fraction into two parts, an exponent and a mantissa.
The computer industry agreed upon a standard for the storage of floating
point numbers. It is called the IEEE 754 standard and uses 32 bits of memory
(single precision) or 64 bits (double precision). However, the syllabus only covers
the IEEE single precision floating point representation.
i)

IEEE Short Real: 32 bits

Total number
of bits:

1 bit for the sign, 8 bits for the exponent, and


23 bits for the mantissa. Also called
single precision.

23

Sign

Biased Exponent

Mantissa (fraction)

Exponent system = excess 127


ii)

IEEE Long Real: 64 bits

Total number
of bits:

1 bit for the sign, 11 bits for the exponent, and


52 bits for the mantissa. Also called
double precision.

11

52

Sign

Biased Exponent

Mantissa (fraction)

Exponent system = excess 1023


If the leftmost digit in a fraction or a floating point number is not zero, it is
called normalized.
The mantissa is normalized by moving the bit patterns to the left (each shift
subtracts one from the exponent value) till the first 1 drops off.
The combination of the leading 1 bit, binary point and the 23 or 52 bits
mantissa is called significand. All normalized numbers have significands, s in
range : 1 s 2.

Example 31:
Convert 12.5010 to the IEEE single precision floating point representation.

20

Steps:
The number is first converted into the format:
2n X 0.xxxxxx
where,
n : exponent
0.xxxxxx : mantissa
Now, the IEEE single precision format looks like,
Total number
of bits:

23

Sign

Biased Exponent

Mantissa (fraction)

To find the exponent and the mantissa, keep dividing the number by 2 till a fraction
between 0 and 1 results. The fraction is the mantissa value, the number of
divisions is the exponent value.
12.5 / 2 = 6.25
6.25 / 2 = 3.125
3.125 / 2 = 1.5625
1.5625 / 2 = 0.78125
Thus the values now are,
0.78125 X 24
The exponent bit pattern is stored using an excess of 127. This means that this
value is added to the exponent when storing (and subtracted when removing).
The exponent bit pattern to store is,
4 + 127 = 131 = 100000112
As the mantissa is a positive value, the sign bit is 0.
To work out the mantissa, each bit represents 2 to the power of a negative
number. It looks like,
1st bit of mantissa
2nd bit of mantissa
3rd bit of mantissa
4th bit of mantissa
5th bit of mantissa
etc

=
=
=
=
=

0.5
0.25
0.125
0.0625
0.03125

The mantissa 0.78125 = 110010000000000000000002


(0.5 + 0.25 + 0.03125)
However, the mantissa is normalized, by moving the bit patterns to the left (each
shift subtracts one from the exponent value) till the first 1 drops off.
The resulting pattern is then stored.
The mantissa now becomes
10010000000000000000000

21

and the exponent is adjusted to become


131 1 = 130 = 100000102
The final assembled format is,

1 bits

8 bits

23 bits

10000010

100 1000 0000 0000 0000 0000

Sign:(+ve)

Biased
Mantissa (fraction)
Exponent
Convert the number into hexadecimal,
0100 0001 0100 1000 0000 0000 0000 00002
= 4 1 4 8 0 0 0 016
Other ways of computing the floating point numbers representation are shown in
Examples 32 to 34.
Example 32:
Convert 0.510 to the IEEE single precision floating point format.
Steps:
1.

Convert 0.510 to binary:


0.5
Therefore, 0.510 = 0.12
X 2
1.0
Then, put into 1.xxxx X 2y format:
mantissa
0.510 = 0.12 X 20
= 1.0 X 2-1
Mantissa = 0
= 000 0000 0000 0000 0000 0000 (represented in 23 bits)

2.

Get the biased exponent:


127 + y = 127 + (-1) = 12610 = 0111 11102

3.

Put into the IEEE single precision format:

4.

1 bits

8 bits

23 bits

01111110

000 0000 0000 0000 0000 0000

Sign:(+ve)

Biased Exponent

Mantissa (fraction)

Convert the number into hexadecimal:


0011 1111 0000 0000 0000 0000 0000 0000
= 3 F 0 0 0 0 0 016

22

Example 33:
Convert -1.510 to the IEEE single precision floating point format.
Firstly, convert 1.510 to binary:
0.5
1.510 = 1.12
X 2
1.0
= 1.1 X 20
=0
= 127 + 0 = 12710 = 0111 11112
=1
= 100 0000 0000 0000 0000 0000
(represented in 23 bits)
Therefore, the assembled format:
Significand
Exponent
Biased exponent
Mantissa

1 bits

8 bits

23 bits

01111111

100 0000 0000 0000 0000 0000

Sign:(+ve)

Biased Exponent

Mantissa (fraction)

Convert the number into hexadecimal:


1011 1111 1100 0000 0000 0000 0000 0000
= B F C 0 0 0 0 016

Example 34:
Convert 15/51210 to the IEEE single precision floating point format.
-15/512 = -15/29
= -15 X 2-9
= (-) 11112 X 2-9
=(-)1.1112 X 2-6
Sign-bit
Exponent
Biased exponent
Significand
Mantissa

= 1 (-ve)
= -6
= -6 + 127 = 12110 = 0111 10012
= 1.111
= 111 0000 0000 0000 0000 0000
(represented in 23 bits)
Therefore, the IEEE single precision floating point format:

1 bits

8 bits

23 bits

01111001

111 0000 0000 0000 0000 0000

Sign:1
(-ve)

Biased Exponent

Mantissa (fraction)

Convert the number into hexadecimal:


1011 1100 1111 0000 0000 0000 0000 0000
= B C F 0 0 0 0 016

23

Converting representation the IEEE single precision floating


point format from hexadecimal to decimal
Example 35:
Convert the IEEE single precision floating point format 42E48000h to decimal.
The binary representation for the hexadecimal number is:
0100 0010 1110 0100 1000 0000 0000 0000
Sign:0
(+ve)

Biased Exponent

Mantissa

By following the IEEE format,


Sign-bit
Biased Exponent
Actual Exponent
Mantissa
Significand

= 0 (+ve)
= 1000 01012 = 13310
= 133 - 127 = 610
= 1100 10012
= 1.110010012 X 26
= 1 + (1 X 2-1) + (1 X 2-2) + (1 X 2-5) + (1 X 2-8) X 64
= 1 + 1/2+ 1/4+ 1/32 + 1/256 X 64
= 114.25
OR 1.11001001 x 26 = 1110010.01
= 64 + 32 + 16 + 2 +1/4
= 114.25

EXERCISE:
1.

Convert the following decimal numbers into the IEEE single precision floating point
representation:
a)
b)
c)

2.

15.5
171.625
7/64

d)
e)
f)

-12.625
-100.5
-21/128

Convert the following IEEE floating point representation to decimal:


a)
b)

BC800000
C2F00000

c)
d)

3C540000
6AF30000

Das könnte Ihnen auch gefallen