bigdecimal icon indicating copy to clipboard operation
bigdecimal copied to clipboard

Incorrect calculation result after upgrading from BigDecimal 3.1.1 to 3.1.2

Open d4rky-pl opened this issue 2 years ago • 1 comments

Reproduction script

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'bigdecimal', '3.1.1'
end

a = BigDecimal(1) - BigDecimal(1000) / BigDecimal(1100)
b = BigDecimal(2000) / (BigDecimal(1) - a)

p b

Result for 3.1.1: 0.22e4 (correct) Result for 3.1.2: 0.219999999999999999999999999999999999978e4 (incorrect)

d4rky-pl avatar Oct 05 '23 07:10 d4rky-pl

Similar to https://github.com/ruby/bigdecimal/issues/222

broksonic21 avatar Dec 11 '23 15:12 broksonic21