Created
September 7, 2011 12:29
-
-
Save mattsoutherden/1200438 to your computer and use it in GitHub Desktop.
Strange Ruby Behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> d.wordpress_deal.merchant_value | |
=> 37.05 | |
>> d.wordpress_deal.merchant_value * 100 | |
=> 3705.0 | |
>> (d.wordpress_deal.merchant_value * 100).to_i | |
=> 3704 | |
>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
don't ask
see http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conversion_and_rounding