1

From what I can gather, whole numbers that can be fit in the mantissa of a floating point number are represented exactly:

Can a IEEE 754 real number "cover" all integers within its range?

My question is:

  • Given 2 floating point whole numbers that are exactly represented,
  • does an operation (+,-,/,*) on the 2 numbers always produce an exactly represented floating point number
  • so long as the result is in the exactly representable range?

In other words, is there ever a time when floating point 2.0 * 3.0 != 6?

Community
  • 1
  • 1
Rich C
  • 3,164
  • 6
  • 26
  • 37

1 Answers1

4

Yes, this falls out from the requirement that the basic operations are correctly rounded. Since the result is exactly representable it is also the correctly rounded result.

Stephen Canon
  • 103,815
  • 19
  • 183
  • 269