Skip to content

Instantly share code, notes, and snippets.

@kenchan
Created October 23, 2019 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenchan/39d2722bb328eae6b3371745e73e5dce to your computer and use it in GitHub Desktop.
Save kenchan/39d2722bb328eae6b3371745e73e5dce to your computer and use it in GitHub Desktop.
irb(main):013:0> require 'bigdecimal'
=> false
irb(main):014:0> 10.times.inject(0.0) {|i, _| i + 0.1 }.to_i
=> 0
irb(main):015:0> 10.times.inject(BigDecimal("0.0")) {|i, _| i + BigDecimal("0.1") }.to_i
=> 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment