Last active
August 29, 2015 13:56
-
-
Save ledermann/8800404 to your computer and use it in GitHub Desktop.
Dividing with BigDecimal - Ruby 1.9.3 vs. Ruby 2.1.0
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
# Using Ruby 1.9.3 on OS X, installed via rbenv | |
~ $ irb | |
irb(main):001:0> require "bigdecimal" | |
true | |
irb(main):002:0> BigDecimal("0.2") / BigDecimal("0.5") | |
0.4 |
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
# Using Ruby 2.1.0 on OS X, installed via rbenv | |
~ $ irb | |
irb(main):001:0> require "bigdecimal" | |
true | |
irb(main):002:0> BigDecimal("0.2") / BigDecimal("0.5") | |
0.0 |
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
# Using Ruby 2.1.0 with bigdecimal v1.2.5 | |
~ $ irb | |
irb(main):001:0> gem "bigdecimal", "=1.2.5" | |
true | |
irb(main):002:0> require "bigdecimal" | |
true | |
irb(main):003:0> BigDecimal("0.2") / BigDecimal("0.5") | |
0.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solution: Gem "bigdecimal" <= v1.2.3 is broken, bug is fixed in v1.2.4
https://www.ruby-forum.com/topic/4419577