Skip to content

Instantly share code, notes, and snippets.

@thechrisoshow
Created November 26, 2008 11:43
Show Gist options
  • Save thechrisoshow/29366 to your computer and use it in GitHub Desktop.
Save thechrisoshow/29366 to your computer and use it in GitHub Desktop.
What's wrong with this?
> 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