Created
November 26, 2008 11:43
-
-
Save thechrisoshow/29366 to your computer and use it in GitHub Desktop.
What's wrong with this?
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
> bits = [15.8, 8.0, 9.4, 3.0, 1.6, 2.0, 12.0, 4.8, 1.7, 6.0, 3.0, 17.7, 6.0, 4.0, 3.0, 2.0] | |
=> [15.8, 8.0, 9.4, 3.0, 1.6, 2.0, 12.0, 4.8, 1.7, 6.0, 3.0, 17.7, 6.0, 4.0, 3.0, 2.0] | |
> result = bits.inject(0.0) {|sum, v| sum += v} | |
=> 100.0 | |
> result > 100.0 | |
=> true | |
> # huh!? why is 100.0 > 100.0 | |
> # Although admittedly this is in Ruby 1.8.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment