Actions
Backport #1910
closedBigDecimal addition inaccuracy 3.6525+24.35 != 28.25
Status:
Closed
Assignee:
-
Description
=begin
ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]
I tried this sum and got the answer 28.25 instead of 28.0025:
result = BigDecimal.new("3.6525") + BigDecimal.new("24.35")
puts result.to_f
Prints "28.25" instead of "28.0025"
=end
Updated by eliotsykes (Eliot Sykes) about 15 years ago
=begin
Further research shows this issue may have been fixed in p174:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/338957
From the changelog:
Fri Jun 12 16:36:44 2009 Yukihiro Matsumoto matz@ruby-lang.org
* ext/bigdecimal/bigdecimal.c (VpToString): fixed a bug introduced
in r23613. [ruby-talk:338957]
=end
Updated by shyouhei (Shyouhei Urabe) about 15 years ago
- Status changed from Open to Closed
=begin
... and has been backported to 1.8.7-p174. Get a newer version.
=end
Actions
Like0
Like0Like0