You are on page 1of 19

COA UNIT 2

FLOATING POINT ARITHMETIC


Floating/Fractional Point Numbers

 To handle fractional quantities.


 Fixed point/Integer numbers - the position of this radix point is
fixed.
 Floating point numbers – the radix point is not fixed in a
particular position.
Representing Fractional Numbers
Examples

• If you move the radix point to the left, it means - divide by 2


• If you move the radix point to the right, it means - multiply by 2
• If you have a number of this form 0.11111, it means the value is less than 1
Limitations
IEEE 754 Representation
(32-bit / Single precision format)

Example:
IEEE 754 Representation
(32-bit / Single precision format)

Example:
Exponent alignment
Exponent alignment

 Ifthe exponents don't match, we can't simply add the mantissa


together while adding floating point numbers
 So, adjust one of the exponents to match the other.
 For that, make the smaller exponent match the larger one.
 Itcan be done by moving the decimal point to the left or right to make the exponents the
same (E1==E2) i.e., move the bit positions(larger exponent – smallest
exponent, E1-E2 or E2-E1) left or right and,
increase or decrease the exponent by E1-E2 or E2-E1 to compensate.
Floating point binary
addition/Subtraction

 Make sure that both numbers are normalized


 Make the exponents the same
 Add/Sub the mantissa together and
 Normalize the result, if necessary.
Floating point addition example

You might also like