1

I was multiplying a floating point number by hundred, only to see it round it off. The same does not happen when multiplying by 10 or 1000.

546.55 * 100 = 54654.99999999999

546.55 * 10 * 10 = 54655.0

546.55 * 1000 = 546550.0 (this is something I tried just to see how it behaves on powers of 10 greater than 100)

Shouldn't multiplication by 100 and multiplication by 10*10 have the same result? Will an interpreter understand 100 and 10*10 as different?

Projjol
  • 1,195
  • 2
  • 12
  • 26

0 Answers0