0% found this document useful (0 votes)
71 views29 pages

Chp2 Numberingsystem

This document discusses number systems and conversions between different bases. It covers: 1) Representing integers and fractional numbers in binary, octal, and hexadecimal. 2) The relationship between the decimal number system and other number systems like binary, octal, and hexadecimal. 3) Examples of converting between decimal, binary, octal, and hexadecimal numbers through division and multiplication.

Uploaded by

heyfiez12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views29 pages

Chp2 Numberingsystem

This document discusses number systems and conversions between different bases. It covers: 1) Representing integers and fractional numbers in binary, octal, and hexadecimal. 2) The relationship between the decimal number system and other number systems like binary, octal, and hexadecimal. 3) Examples of converting between decimal, binary, octal, and hexadecimal numbers through division and multiplication.

Uploaded by

heyfiez12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 29

1

CHAPTER 2

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 two’s 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:

PLACE
BASE th
5 place 4th
3rd
2nd
1st
Single ● 1st 2nd place 3rd place
place place place place unit place
105 104 103 102 101 100 ● 10-1 10-2 10-3
decimal 100,000 10,000 1,000 100 10 1 0.1 0.01 0.001
1/10 1/100 1/1000
25 24 23 22 21 20 ● 2-1 2-2 2-3
binary 32 16 8 4 2 1 0.5 0.25 0.125
1/2 1/4 1/8
85 84 83 82 81 80 ● 8-1 8-2 8-3
32,768 4,096 512 64 8 1 0.125 0.015625 1.953125
octal
X 103
1/8 1/64 1/512
5 4 3 2 1 0
16 16 16 16 16 16 ● 16-1 16-2 16-3
1,048,576 65,536 4,096 256 16 1 0.0625 3.906 X 2.4414062
hexadecimal
103 X 104
1/16 1/256 1/4096
2

2.1 PERFORMING ARITHMETIC OPERATIONS IN DIFFERENT


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

Decimal Binary Octal Hexadecimal


0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

2.1.1 Addition And Subtraction of Binary Numbers

Example 1:

11111
1011 1100
+ 1100 1111
1 1000 1011

Example 2:

11
1001
+ 11
0110

2.1.2 Addition And Subtraction of Octal Numbers

Example 3:

1 1 1
333 3 + 6 = 9 => 11
+ 476
3

1031 3 + 7 = 10 + 1 = 11 => 13
3 + 4 = 7 + 1 = 8 => 10
Example 4:

618
723 3 - 6 => 8 + 3 - 6 = 5
- 536 1 – 3 => 8 + 1 – 3 = 6
165 6–5=1

2.1.3 Addition And Subtraction of Hexadecimal Numbers

Example 5:

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

Example 6:

E 15 15
1F00A A – 2 = 10 – 2 = 8
- B2 0 – B = 16 – 11 = 5
0 -> 16 – 1 = 15 = F
1EF58 F–1=E
1 -> 1

EXERCISE

1. Perform the addition and subtraction for the following binary numbers:

a) 10 + 111010 d) 10001011 – 100111


b) 1000 + 1011 e) 11000 – 1111
c) 10011100 + 10111 f) 1100110 – 111010

2. Perform the addition and subtraction for the following octal numbers:

a) 677 + 2356 d) 673 - 25


b) 45 + 47 e) 6006 - 7
c) 4007 + 112377 f) 4510 - 571

3. Perform the addition and subtraction for the following hexadecimal numbers:

a) B677 + CE79 d) A5 - 17
b) 21BA + ADD e) 7AC - 3B1
c) 9A3B + FACE f) FA51 - A76
4

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 balance 1
18 ÷ 2 = 9 balance 0
9÷2 = 4 balance 1
4÷2 = 2 balance 0
2÷2 = 1 balance 0
1÷2 = 0 balance 1

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. Convert the integer to binary by using method shown in Example 1.


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

So, (0.6875)10 = (0.1011)2 Therefore, 37.687510 = 100101.10112


5

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


6

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 balance 5
1 ÷ 16 = 0 balance 1

Therefore , 2110 = 1516

Example 14:
Convert 21.2510 to hexadecimal.

Steps:
From Example 7,
21 ÷ 2 = 10 balance 1
10 ÷ 2 = 5 balance 0
5÷2 = 2 balance 1
2÷2 = 1 balance 0
1÷2 = 0 balance 1

So, 2110 = 101012

Now, 0.25

0.25
X 2
0 0.50
X 2
1 1.00

** convert 10 → 2 → 16
So, (0.25)10 = (0.01)2

- Refer to conversion of
binary to hexadecimal
7
8
9

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, E5.A816 = 229.6562510

2.2.6 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


10

F 1
11

Example 18:
Convert 95AD16 to binary.

95AD16 = 1001 0101 1010 11012

9 5 A 1

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.

011 100 111 010 1112

3 4 7 2 78

2.2.9 Conversion of hexadecimal to binary and octal to binary

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

Hex 1 9 9 5 . A B
.
Binary 0001 1001 1001 0101 1010 1011
.
Octal 0 1 4 6 2 5 5 2 6
12

Example 22:
Convert 101111111000011.110111100110 2 to hexadecimal and octal.

Hex 5 F C 3 . D E 6
.
Binary 0101 1111 1100 0011 1101 1110 0110
.
Octal 0 5 7 7 0 3 6 7 4 6
13
14

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. Decimal Binary Octal Hexadecimal


(a) 1234
(b) 10110111
(c) 73
(d) 6FDA

6. Find the binary representation for:


a) 13.43510 c) 13.58 e) 1A.3B16
b) 43.62510 d) 31.068 f) BC.0116

7. Convert the following numbers to decimal:


a) 1101.1012 c) 73.128 e) CA.F116
b) 1001.011012 d) 41.038 f) 6E.A316
15

2.3 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 100 0001 41 0 011 0000 30
B 100 0010 42 1 011 0001 31
C 100 0011 43 2 011 0010 32
D 100 0100 44 3 011 0011 33
E 100 0101 45 4 011 0100 34
F 100 0110 46 5 011 0101 35
G 100 0111 47 6 011 0110 36
H 100 1000 48 7 011 0111 37
I 100 1001 49 8 011 1000 38
J 100 1010 4A 9 011 1001 39
K 100 1011 4B
L 100 1100 4C Space 010 0000 20
M 100 1101 4D Full stop 010 1110 2E
N 100 1110 4E ( 010 1000 28
O 100 1111 4F + 010 1011 2B
P 101 0000 50 $ 010 0100 24
Q 101 0001 51 * 010 1010 2A
R 101 0010 52 ) 010 1101 29
S 101 0011 53 - 010 1111 2D
T 101 0100 54 / 010 1100 2F
U 101 0101 55 Comma 010 1100 2C
V 101 0110 56 = 011 1101 3D
W 101 0111 57
X 101 1000 58
Y 101 1001 59
Z 101 1010 5A
16

2.4 THE DECIMAL REPRESENTATION


BCD (Binary Coded Decimal) is often used to represent decimal number in
binary.

Decimal BCD For example, the decimal value of 98 is


0 0000 represented in BCD as 1001 1000BCD.
1 0001 But in binary, 9810 = 11000102
2 0010 Method:
3 0011 2 98 balance 0 (LSB)
4 0100 2 49 balance 1
5 0101 2 24 balance 0
6 0110 2 12 balance 0
7 0111 2 6 balance 0
8 1000 2 3 balance 1
9 1001 2 1 balance 1 (MSB)

2.5 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) 1’s complement representation
c) 2’s 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 0’s and 1’s 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).
17

Example 24:

0100101 0000000000000001 0111111111111111


(+1) (+32767)
+ 37
1100101 1000000000000001 1111111111111111
(-1) (-32767)
- 37

Example 25:
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 00011111 2.
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 sign-
and-magnitude of –31 is 100111112

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.
18

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 : 10110011 Number : 00100110


Sign : 1 (negative) Sign : 0 (positive)
Magnitude : 0110011 Magnitude : 0100110
= (1 X 25) + (1 X 24) + = (1 X 25) + (1 X
(1 X 21) + (1 X 20) 22)
= 32 + 16 + 2 + 1 + (1 X 21)
= 51 = 32 + 4 + 2
= 38
Decimal -51 Decimal +38
value value

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 One’s Complement Convention

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


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

2.6.3 The Two’s Complement Convention

The two’s complement convention or 2’s complement is the most popular


among computer manufacturers since it does not present any of the problems of
the sign-and-magnitude or one’s 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 two’s 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 0000 0000 1111 1111 1000 0000


(127) (0) (-1) (-128)
(2n-1 – 1) -(2n-1)
19

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


process shown below:

Step 1: Express the absolute value of the number in binary.


Step 2: 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 “1’s
complement”.
Step 3: Add one to the binary number of step 2.

Example 28:
What is the 2’s complement representation of –23?

Step 1: The absolute value of the number is 23.


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

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


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

Example 29:
What is the decimal positive value of the 2’s 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 (1’s complement)
Step 3: Add 1,
00011100
+ 1
00011101

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.
20

2.6.3.1 The Arithmetic Operation In Two’s Complement

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

i) 13 + 31

13 0000 1101
31 + 0001 1111
44 0010 1100

ii) 21 – 5
510 = 0000 01012
1111 1010 (1’s complement)
+ 1
1111 1011 (2’s complement)
21 0001 0101
-5 + 1111 1011
16 1 0001 0000

carry is discarded

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

EXERCISE

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

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-and-


magnitude, 1’s complement and 2’s complement:
No. Decimal Sign-and- 1’s 2’s
Magnitude 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 2’s complement method, perform the subtraction operation for the
followings:
a) 5–3 d) 57 – 63
b) 4–7 e) 61 – 27
c) 35 – 46 f) 13 – 104
23

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 1 bit for the sign, 8 bits for the exponent, and
23 bits for the mantissa. Also called single
precision.

Total number
of bits: 1 8 23

Sign Biased Exponent Mantissa (fraction)

Exponent system = excess 127

ii) IEEE Long Real: 64 bits 1 bit for the sign, 11 bits for the exponent,
and 52 bits for the mantissa. Also called
double precision.

Total number
of bits: 1 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:
24

Convert 12.5010 to the IEEE single precision floating point representation.

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: 1 8 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 = 0.5


2nd bit of mantissa = 0.25
3rd bit of mantissa = 0.125
4th bit of mantissa = 0.0625
5th bit of mantissa = 0.03125
etc

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
25

shift subtracts one from the exponent value) till the first 1 drops off.

The resulting pattern is then stored.

The mantissa now becomes

10010000000000000000000

and the exponent is adjusted to become

131 – 1 = 130 = 100000102

The final assembled format is,

1 bits 8 bits 23 bits


0 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.
26

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:

1 bits 8 bits 23 bits


0 01111110 000 0000 0000 0000 0000 0000

Sign:(+ve) Biased Exponent Mantissa (fraction)

4. Convert the number into hexadecimal:


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

Example 33:
Convert -10.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

Significand = 1.1 X 20
Exponent = 0
Biased exponent = 127 + 0 = 12710 = 0111 11112
Mantissa = 1
= 100 0000 0000 0000 0000 0000
(represented in 23 bits)

Therefore, the assembled format:

1 bits 8 bits 23 bits


1 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
28

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 = 1 (-ve)
Exponent = -6
Biased exponent = -6 + 127 = 12110 = 0111 10012
Significand = 1.111
Mantissa = 111 0000 0000 0000 0000 0000
(represented in 23 bits)

Therefore, the IEEE single precision floating point format:

1 bits 8 bits 23 bits


1 01111001 111 0000 0000 0000 0000 0000

Sign:1 Biased Exponent Mantissa (fraction)


(-ve)

Convert the number into hexadecimal:


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

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 Biased Exponent Mantissa


(+ve)

By following the IEEE format,

Sign-bit = 0 (+ve)
Biased Exponent = 1000 01012 = 13310
Actual Exponent = 133 - 127 = 610
Mantissa = 1100 10012
Significand = 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) 15.5 d) -12.625
b) 171.625 e) -100.5
c) 7/64 f) -21/128

2. Convert the following IEEE floating point representation to decimal:

a) BC800000 c) 3C540000
b) C2F00000 d) 6AF30000

You might also like