0% found this document useful (0 votes)
3 views

2.5 Floating Point Addition and Multiplication

sadfv

Uploaded by

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

2.5 Floating Point Addition and Multiplication

sadfv

Uploaded by

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

Floating Point Arithmetic - Addition,Subtraction and Multiplication :

Floating-point numbers are coded as sign/magnitude, reversing the sign-bit inverses


the sign. Consequently the same operator performs as well addition or subtraction
according to the two operands signs. The steps in floating point addition are:

Rewrite the smaller number such that its exponent matches with the exponent

of the larger number

· Add the mantissas

· Renormalize the mantissa by shifting mantissa and adjusting the exponent.

· Check for overflow/underflow of the exponent after normalization.

· If the mantissa does not fit in the space reserved for it, it has to be rounded
off.

The addition operation proceeds as the exponent of one operand is subtracted from
the other using the small ALU to determine which is larger and by how much. This
difference controls the three multiplexors; from left to right, they select the larger
exponent, the significant of the smaller number, and the significant of the larger
number. The smaller significant is shifted right, and then the significant are added
together using the big ALU. The normalization step then shifts the sum left or right
and increments or decrements the exponent. Rounding then creates the final result,
which may require normalizing again to produce the final result.

Floating Point Addition – Examples :

1. Add 0.5 + (-0.4375)

0.5 = 0.1 × 20 = 1.000 × 2-1(normalized)

-0.4375 = -0.0111 × 20 = -1.110 × 2-2(normalized)

Step 1: Rewrite the smaller number such that its exponent matches with the
exponent of the larger number.

-1.110 × 2-2 = -0.1110 × 2-1

Step 2: Add the mantissas

1.000 × 2-1 +

-0.1110 × 2-1

0.001 × 2-1

Step 3: Renormalize the mantissa by shifting mantissa and adjusting the


exponent.s0.001 × 2-1= 1.000 × 2-4

-126 <= -4 <= 127 (-4 is within the range of -126 and 127).No overflow or
underflow

Step 4: The sum fits in 4 bits so rounding is not required


2. Add the following two decimal numbers in scientific notation:

8.70 × 10-1 with 9.95 × 101

1. Rewrite the smaller number such that its exponent matches with the
exponent of the larger number.

8.70 × 10-1 = 0.087 × 101

2. Add the mantissas

9.95 + 0.087 = 10.037 and write the sum 10.037 × 101

3. Put the result in Normalised Form

10.037 × 101 = 1.0037 × 102(shift mantissa, adjust exponent)

check for overflow/underflow of the exponent after normalisation

4. Round the result

If the mantissa does not fit in the space reserved for it, it has to be rounded
off.

For Example: If only 4 digits are allowed for mantissa

1.0037 × 102 ===> 1.004 × 102


Floating Point Multiplication

The following are the steps in floating point multiplication:

· Add the exponents

· Multiply the significant digits

· Normalize the product

· Round-off the product (if necessary)

Example :

Multiply the following two numbers in scientific notation by hand:

1.110 × 1010 × 9.200 × 10-5

1. Add the exponents to find

New Exponent = 10 + (-5) = 5

If we add biased exponents, bias will be added twice. Therefore


we need to subtract it once to compensate:

(10 + 127) + (-5 + 127) = 259

259 - 127 = 132 which is (5 + 127) = biased new exponent

2. Multiply the mantissas


1.110 × 9.200 = 10.212000

Can only keep three digits to the right of the decimal point, so the result is

10.212 × 105

3. Normalise the result

1.0212 × 106

4. Round it

1.021 × 106

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy