1

I have got two floating point numbers and need to calculate them in the following way:

-1.724444389 (and a ton more digits) * 2^(126) + -1.342222094535 (and a ton more digits) * 2^(-108)

My question is how would I go about doing this in a 'clean' fashion'?

The way I look at it now, I'd change the exponents such that they are equivalent, this would done through shifting? Then just calculate the -1.724.. & -1.34.. as per usual. Or is there a 'better' way?

  • In IEEE floating point you can't do this without increasing your precision quite a bit. But yes, the answer is just shifting, nothing else works. – Ian Jan 30 '15 at 02:21
  • I would point out that the second number is extremely insignificant in comparison to the first. For practical computation, it can typically be dropped in addition. But I don't know your specific application – MPW Jan 30 '15 at 03:16

0 Answers0