Skip to content

Commit 175770b

Browse files
committed
BigDecimal('0.') with bigdecimal-3.1.9 returns 0.0
1 parent b82ad36 commit 175770b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec/ruby/library/bigdecimal/BigDecimal_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@
9898
BigDecimal("invalid", exception: false).should be_nil
9999
BigDecimal("0invalid", exception: false).should be_nil
100100
BigDecimal("invalid0", exception: false).should be_nil
101-
BigDecimal("0.", exception: false).should be_nil
101+
if BigDecimal::VERSION >= "3.1.9"
102+
BigDecimal("0.", exception: false).to_i.should == 0
103+
else
104+
BigDecimal("0.", exception: false).should be_nil
105+
end
102106
end
103107
end
104108

0 commit comments

Comments
 (0)