How to subtract IEEE754 floating point?

600 Views Asked by At

I have two numbers represented in floating point:

$A: 10101001001110000000000000000000$

$B: 01000011011000000000000000000000$

For $A$ I know $e=82$ and for $B$, $e=134$ ($e$=exponent), but I don't know how to subtract these numbers in floating point.

How should we make the subtraction?

1

There are 1 best solutions below

2
On BEST ANSWER

Interpreting the floating point bits

A: 1 01010010 01110000000000000000000

B: 0 10000110 11000000000000000000000

gives indeed $$ A=-2^{82-127}\cdot(1.0111)_2 \\ B=+2^{134-127}\cdot(1.1100)_2 $$ The exponent difference is so large that when shifting both numbers towards the larger exponent, $A$ gets shifted/rounded to zero. The operation is thus in this case trivial.