Created
May 21, 2011 02:39
-
-
Save tiegz/984177 to your computer and use it in GitHub Desktop.
Argh
This file contains hidden or 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
puts a = (2500 * 56) / 10000.0 # => 14.0 | |
puts b = (250 * 5.6) / 100.0 # => 14.0 | |
puts c = 25 * 0.56 # => 14.0 | |
puts a % 1 # => 0 ... Expected | |
puts b % 1 # => 0 ... Expected | |
puts c % 1 # => 1.77635683940025e-15 .. Not Expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hahaha; the power of Ruby lies in the ease to fix itself :)