I just encountered this and can\'t figure out why exactly Ruby behaves this way.
Could someone explain why in Ruby:
6.84 - 3.6 == 3.2399999999999998
Floating point uses an internal representation that's inherently imprecise. You should always round down your answers for display purposes:
'%.4f' % (6.84 - 3.6)
# => "3.2400"
Left to its own devices, Ruby, like many other languages, will express floating point numbers to a ridiculous degree of precision.