Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

Starter: Revision of fixed point binary and

two’s complement
Represent the following numbers in fixed f) 11100002
point binary
Convert the following negative denary
a) 3.7510 numbers to signed binary integers.
b) 5.12510 g) -2810
c) 2.37510 h) -8110
i) -11910
Convert the following signed integers to
denary
d) 11011112
e) 10101012
Starter: Revision of fixed point binary and
two’s complement with answers
Represent the following numbers in fixed f) 11100002 -1610
point binary
Convert the following negative denary
a) 3.7510 11.112 numbers to signed binary integers with 8
bits
b) 5.12510 101.0012
g) -2810 111001002
c) 2.37510 10.0112
h) -8110 101011112
Convert the following signed integers to i) -11910 100010012
denary
d) 11011112 -1710
e) 10101012 -4310
Floating point representation
Learning objectives: Represent real numbers in binary using floating
point
Floating point representation
We have seen how we can represent real numbers using fixed point binary. We are now
going to look at how real numbers can also be represented as floating point numbers.

Floating point representation allows us to have a greater range of numbers for a given
number of bits than fixed point binary.

Floating point numbers are split into two parts:


• Mantissa – Represents the significant bits of a number. The larger number of bits
used to represent the mantissa the greater the precision.
• Exponent – The power to which the mantissa is raised. The larger the number of bits
used to represent the exponent the greater the range of numbers.
Real numbers
The number 0.001234 can also be represented as 1.234 x 10 -3
The number 123,400,000 can also be represented as 1.234 x 10 8

For 1.234 x 10 -3
1.234 is the mantissa (the significant values)
10 -3 is the exponent (the power to which the number is raised)
Real numbers

Sign bit

0 .1 1 1 0 1 1 0 0 0 0 0 0 1 0 0

Implied point Mantissa Exponent

• In this scenario we have 10 bits for the mantissa and 6 bits for the exponent.
• The sign bit determines whether the number is positive or negative. If the sign bit is 0 then the
number will be positive and if the sign bit is 1 then the number will be negative.
• Likewise the first (leftmost) bit of the exponent determines whether the exponent is positive or
negative.
• In this example both the mantissa and exponent are positive.
• The imaginary point is placed directly after the sign bit.
Real numbers: Positive mantissa and positive
exponent (Big positive numbers)
Example: Convert the following 16 bit floating point number where the first 10 bits
represent the mantissa and the remaining 6 bits represent the exponent to denary
0 1 1 1 0 1 1 0 0 0 0 0 0 1 0 0

0 .1 1 1 0 1 1 0 0 0 0 0 0 1 0 0

Exponent: 00001002 = 410


Mantissa: 0.1110110002
The binary point of the mantissa moves 4 points to the right thus:
01110.110002 = 14.7510
Convert the following numbers to denary (10 bits
represent the mantissa and 6 bits represent the exponent)

a) 0101000110 0001002
1010.00112 = 10.187510
b) 0100010100 0001102
100010.12 = 34.510
c) 0111010000 0000102
11.1012 = 3.62510
Real numbers: Positive mantissa and negative
exponent (small positive number)
Example: Convert the following 16 bit floating point number where the first 10 bits represent the
mantissa and the remaining 6 bits represent the exponent to denary
0 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0

0 .1 1 0 0 0 0 0 0 0 1 1 1 1 1 0

The exponent is negative so we have to apply two’s complement to find the denary equivalent
Exponent: 1 1 1 1 1 0 2
Flip bits: 0 0 0 0 0 1 2
Add 1: 0 0 0 0 1 0 2 = -2 10
Mantissa: 0 . 1 1 0 0 0 0 0 0 0 2
The binary point of the mantissa moves 2 points to the left thus: 0 . 0 0 1 1 2 = 0.1875
Convert the following numbers to denary (10 bits
represent the mantissa and 6 bits represent the exponent)

a) 0111000000 1111012

b) 0101000000 1111102

c) 0110000000 1111112
Convert the following numbers to denary (10 bits
represent the mantissa and 6 bits represent the exponent)

a) 0111000000 1111012
Flip bits: 0000102
Add 1: 0000112 = -310
0.0001112 = 0.1093752
b) 0101000000 1111102
0.1562510
c) 0110000000 1111112
0.37510
Real numbers: Negative mantissa and
positive exponent (big magnitude negative
numbers)
Example: Convert the following16 bit floating point number where the first 10 bits represent the mantissa and
the remaining 6 bits represent the exponent to denary
1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0

1 .0 1 0 1 0 0 0 0 0 0 0 0 1 0 0

Exponent: 0 0 0 1 0 0 2 = 4 10
The mantissa is negative so we have to apply two’s complement
Mantissa: 1 . 0 1 0 1 0 0 0 0 0 2
Flip bits: 0 . 1 0 1 0 1 1 1 1 1 2
Add 1: 0.1011000002
The binary point of the mantissa moves 4 points to the right thus:
1 0 1 1 . 0 = -11.0
Convert the following numbers to denary (10 bits
represent the mantissa and 6 bits represent the exponent)

a) 1001101100 0000112

b) 1011010100 0000102

c) 1010101000 0000012
Convert the following numbers to denary (10 bits represent
the mantissa and 6 bits represent the exponent): Answers

a) 1.001101100 0000112
Exponent=310
Two’s complement mantissa = 0.1100101002
Move bit 3 spaces to the right 0110.0101 2 = -6.312510
b) 1.011010100 0000102
Exponent=210
Two’s complement mantissa = 0.1001011002
Move bit 2 spaces to the right = 010.0101100 2 = -2.3437510
c) 1.010101000 0000012
Exponent=110
Two’s complement mantissa = 0.1010110002
Move bit 1 spaces to the right= 01.01011000 2 = -1.3437510
Real numbers: Negative mantissa and
negative exponent (small negative number)
Example: Convert the following 16 bit floating point number where the first 10 bits represent the
mantissa and the remaining 6 bits represent the exponent to denary
1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0

1 .0 1 0 0 0 0 0 0 0 1 1 1 1 1 0

The exponent is negative so we have to apply two’s complement to find the denary equivalent
Exponent: 1 1 1 1 1 0 2
Flip bits: 0 0 0 0 0 1 2
Add 1: 0 0 0 0 1 0 2 = -2 10
The mantissa is negative so we have to apply two’s complement to find the denary equivalent
0.1100000002
The binary point of the mantissa moves 2 points to the left thus: 0 . 0 0 1 1 2 = -0.187510
Negative mantissa, negative exponent – small
magnitude negative numbers
a) 1.001100000 1111012

b) 1.010100000 1111102

c) 1.011100000 1111112
Negative mantissa, negative exponent – small
magnitude negative numbers
a) 1.001100000 111101
Two’s complement exponent= 0000112 =-310
Two’s complement mantissa = 0.1101000002
Move bit 3 spaces to the left 0.0001101002 = -0.101562510
b) 1.010100000 111110
Two’s complement exponent= 0000102 =-210
Two’s complement mantissa = 0.1011000002
Move bit 2 spaces to the left 0.0010110002 = -0. 17187510
c) 1.011100000 111111
Two’s complement exponent= 0000012 =-110
Two’s complement mantissa = 0.1001000002
Move bit 1 spaces to the left 0.0100100002 = -0.2812510
More practice questions
1. 0.110100000 0001102

2. 0.101000000 1111112

3. 1.011111010 0001012

4. 1.101000000 1111012

5. 1.111111010 0000112
More practice questions
1. 0.110100000 0001002 = 1310

2. 0 101000000 1111112 = 0.312510

3. 1 011111010 0001012 = -16.37510

4. 1 101000000 1111012 = -0.04687510

5. 1 111111010 0000112 = -0.0937510


Homework
Using a real number representation with a 5 bits for the mantissa and 3 bits for the exponent.

a) The largest positive value that can be represented


b) The minimum positive value that can be represented
c) The largest magnitude negative value that can be represented
d) The smallest magnitude negative number that can be represented

Now do the same with 4 bits for the mantissa and 4 bits for the exponent. What is the
difference between the range and precision by using different numbers of bits for the
mantissa and exponent?
Homework
Using a real number representation with a 5 bits for the mantissa and 3 bits for the exponent.
a) The largest positive value that can be represented
0.1111 0112
b) The minimum positive value that can be represented
0.1000 1002
c) The largest magnitude negative value that can be represented
1.0000 0112
d) The smallest magnitude negative number that can be represented
1.0111 1002
Now do the same with 4 bits for the mantissa and 4 bits for the exponent. What is the difference between
the range and precision by using different numbers of bits for the mantissa and exponent?

You might also like