jRuby 1.7.3 is giving an incorrect (or at least inconsistent with MRI and jRuby 1.6.5) answer for a simple division problem
irb(main):002:0> require 'bigdecimal'
The correct answer is 5000. MRI and jRuby 1.6.5 give the correct answer. 1.7.3 does not
Seems to be a duplicate of https://jira.codehaus.org/browse/JRUBY-7101
Although I suspect that the root of the problem is the same as the problem in JIRA this issue report does add some information. It is not just numbers between 0 and 1 as my case divides by 2.2046. I also tried 2.7046:
So it looks the mantissa is being dropped from the divisor?
@vfrride Exactly. That's what causes a division by zero in the JIRA issue, but the issue is much more general, as you pointed out: When dividing a BigDecimal by a float, the divisor seems to be cast into a Fixnum.
@ginkel It's hard to tell from the JIRA if any work is being done on this. I'd be happy to at least create a test on the ruby side, and possibly try to figure out a fix, but I don't want to duplicate effort. Do you know if anyone is working on it?
Here is the work around I am using:
alias :/ :fdiv