Docsity

floating point representation A2, Summaries of Computer science

Partial preview of the text

Download floating point representation A2 and more Summaries Computer science in PDF only on Docsity!

FLOATING POINT

REPRESENTATION

COMPUTER SCIENCE 9618 PAPER 3

FLOATING POINT REPRESENTATION

Floating point representation is a method used in

computers to represent real numbers

14.25 15.75 192.3125 -14.

Mantissa And Exponent

In Math we use decimal numbers and if we need to

write a very large or very small number we use the

concept of Exponents.

For Example :

3.45 x 10 ^ 12

In the example above 3.45 is the Mantissa and 12 is

the exponent with base 10 as the base for Decimal

numbers is 10.

Mantissa : The Most Significant Digit Of FPN

Exponent : Power and because we are dealing with

binary numbers so the base will be 2.

Case 1 : Positive Decimal Number To Binary

Conversion

Question : You have 12 bits for Mantissa and 4 bits for

Exponent. Represent 14.75 in Floating Point

Representation

Step 1 : Write down the memorized list

128 64 32 16 8 4 2 1 0.5^ 0.25^ 0.^

25

125

Step 2 : Put 1 on numbers which will be added to fulfil

Question Requirement

128 64 32 16 8 4 2 1 0.5^ 0.25^ 0.^

25

125

This representation is known as Fixed Point Representation

Step 3 : Move the decimal place all the way to the left

and write the exponent value.

As we moved the decimal 4 places to the left the exponent

value will be 4. If we move the decimal to left exponent

increases and if we move exponent to the right the

exponent decreases

Step 4 : Ignore decimal point and convert the exponent into

binary form

The value of Exponent is 4 so in binary format it will be

represented as 0100

128 64 32 16 8 4 2 1

Now in this stage we have the mantissa value and the

exponent value

0 1 1 1 0 1 1 X 2 ^ 4

As we know that the decimal will always be in between the

first two binary bits and we also know that the base will

always be 2 for binary numbers so we don’t write the base

value and the decimal number in our final answer.

Mantissa Exponent

Case 2 : Negative Decimal Number To Binary

Conversion

Question : You have 12 bits for Mantissa and 4 bits for

Exponent. Represent -14.75 in Floating Point Representation

Step 1 : Ignore Negative sign and follow the steps of case 1

till step 4.

128 64 32 16 8 4 2 1 0.5^ 0.25^ 0.^

25

125

Mantissa Exponent

Step 2 : Exponent would remain same and apply two’s

compliment method on mantissa only and store it.

Two’s Compliment

Two's complement is a mathematical operation on

binary numbers, and it is the most common method

of representing signed integers in computers.

Steps to Find Two's Complement

  1. Invert All Bits: Change all 0s to 1s and all 1s to 0s.
  2. Add One: Add 1 to the inverted binary number.

Mantissa Exponent

Mantissa Exponent

Exam Style Question

Exam Style Question

Case 4 : Negative Binary Number to Denary

Mantissa Exponent

Note : You are just suppose to reverse the steps from case 2.

Calculate the exponent value and first apply two’s

compliment on mantissa and then move the decimal

according to the exponent value and then use the

memorized list to find the denary value.

Mantissa

One’s Compliment 0 1 0 1 0 1 0

Two’s Compliment

128 64 32 16 8 4 2 1 0.5^ 0.25^ 0.^

25

125

So after adding all the values with 1 we will get 14.75 and

as it was a negative number so the answer will be -14.

Case 5 : Negative Exponent Binary Conversion

Mantissa Exponent

In this question see that both mantissa and exponent are

negative as they both are starting with 1. So we need to

apply two’s compliment on both and then calculate.

Two’s Compliment

Exponent

1

So the exponent would be -

Exponent

Normalization

Normalization is a technique that is used to make

your data more accurate.

0.1 Represents positive number

1.0 Represents negative number

How will we figure out that a binary representation is normalized

First and second bit should never be same

Mantissa Exponent

0.356 x 10 ^

If you need to make this in standard form

then you would have to use one power from

the exponent and the final answer would be

3.56 x 10^5. You are suppose to use the same

technique to normalize Floating Point

Representation.

Exam Style Question