Forum: Ruby on Rails Problems doing addition/subtraction with floats

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D2eecb3df7da359aa6f6559fddc39945?d=identicon&s=25 Damon Hill (Guest)
on 2006-04-12 21:55
(Received via mailing list)
Ok, I am sure this is a simplistic problem that I am just missing right
now
(maybe eyes are crossed??).
However, I am trying to do simply math here.

I have these variables initialized as follows:
@amount_due = @amount_paid = @total_due = 0.0

I get @total_due and it is set to 1739.6 from the database.
I then get @amount_paid and it is set to 1739.6 from the database.
I then calculate the @amount_due = @total_due - @amount_paid.

This value is 2.27373675443232e-013.

????

Sorry if this is on the list somewhere and I missed it.

Thanks in advance for any help.

~damon
This topic is locked and can not be replied to.