|
Already fixed at some point, and no follow-up from the reporter.
Reopening; apparently Rails modifies BigDecimal.to_s to be to_s("F"), which is why we couldn't reproduce this. Patch is coming from a community member.
I created this patch off of the jruby 1.0.2 tag. This patch should be applied to the trunk as well. Please let me know if you have any questions.
Fixed another bug in the to_s("F") method that were introduced with my last fix.
This needs to go in the next releases (1.0.4 and 1.1RC2)
Patch does not apply cleanly to trunk, so we'll have to smith it a little.
This should patch cleanly against the trunk. I took the liberty of composing a to_s method out of the spaghetti and leaving engineeringValue and floatingPointValue as the remaining larger methods.
I applied this in 5751 along with a simple test:
assert_equal("0.23", BigDecimal.new("0.23").to_s("F)) If you have any additional tests we could add, from what you saw making this fix, please post them. Thank you for your help! |
|||||||||||||||||||||||||||||||||||||||||||||||||||
$ jirb
irb(main):001:0> require 'bigdecimal'
=> true
irb(main):002:0> puts BigDecimal("0.23").to_s
0.23E0
=> nil
Can you give a test case where "2.3" will be output?