Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.0.0
-
Fix Version/s: JRuby 1.1RC2
-
Component/s: Core Classes/Modules
-
Labels:None
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
The statement puts BigDecimal("0.23") prints "2.3". This is due to the way the whole and fraction part are constructed in to_s, based on the unscaled value. The unscaled value should have a leading 0 in order for the to_s function to work correctly. Included is the RubyBigDecimal.java file with a simple modification. Also included is the testBigDecimal.rb file with cases added for positive and negative numbers with 0 wholes.
I attempted to recreate this using the latest version of jruby, and it appears to already have been fixed...
$ 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?