-1

Any thoughts as to that for which I had not accounted here?

Looks like it returns 99.99999999999999

using ruby 2.3.1p112

Drew
  • 2,583
  • 5
  • 36
  • 54

1 Answers1

1

This was discussed million times - to have precise calculations one must use decimal data type, which in Ruby is represented by BigDecimal class:

BigDecimal(110)/1.1 == 100
#=> true
Community
  • 1
  • 1
Andrey Deineko
  • 51,333
  • 10
  • 112
  • 145
  • Your summary of the million discussions is very approximative. Decimal is not inherently more accurate than binary. Decimal floating-point is better than binary floating-point for decimal numbers, and multiprecision is better than machine arithmetic, but that does not make BigDecimal the panacea that you imply it to be. – Pascal Cuoq Feb 11 '17 at 22:39