mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Update bundled bigdecimal and rbs (#15611)
* Bundle rbs-3.10.0.pre.1 * Update rbs gem entry with commit hash Updated rbs entry to include commit hash. * Fix rbs entry in bundled_gems * Update rbs gem to version 3.10.0.pre.2 Updated rbs gem version from 3.10.0.pre.1 to 3.10.0.pre.2. * Update bundled bigdecimal to v4.0.1 --------- Co-authored-by: Soutaro Matsumoto <matsumoto@soutaro.com>
This commit is contained in:
parent
56b67f1684
commit
7e13fbc0ed
Notes:
git
2025-12-17 18:05:19 +00:00
Merged-By: tompng <tomoyapenguin@gmail.com>
2
NEWS.md
2
NEWS.md
@ -337,7 +337,7 @@ The following bundled gems are updated.
|
||||
* typeprof 0.31.0
|
||||
* debug 1.11.0
|
||||
* base64 0.3.0
|
||||
* bigdecimal 3.3.1
|
||||
* bigdecimal 4.0.1
|
||||
* drb 2.2.3
|
||||
* syslog 0.3.0
|
||||
* csv 3.3.5
|
||||
|
||||
@ -18,14 +18,14 @@ net-pop 0.1.2 https://github.com/ruby/net-pop
|
||||
net-smtp 0.5.1 https://github.com/ruby/net-smtp
|
||||
matrix 0.4.3 https://github.com/ruby/matrix
|
||||
prime 0.1.4 https://github.com/ruby/prime
|
||||
rbs 3.9.5 https://github.com/ruby/rbs 22451ecbe262326176eb3915b64366712930685c # waiting for https://github.com/ruby/rbs/pull/2706
|
||||
rbs 3.10.0.pre.2 https://github.com/ruby/rbs
|
||||
typeprof 0.31.0 https://github.com/ruby/typeprof
|
||||
debug 1.11.0 https://github.com/ruby/debug
|
||||
racc 1.8.1 https://github.com/ruby/racc
|
||||
mutex_m 0.3.0 https://github.com/ruby/mutex_m
|
||||
getoptlong 0.2.1 https://github.com/ruby/getoptlong
|
||||
base64 0.3.0 https://github.com/ruby/base64
|
||||
bigdecimal 3.3.1 https://github.com/ruby/bigdecimal
|
||||
bigdecimal 4.0.1 https://github.com/ruby/bigdecimal
|
||||
observer 0.1.2 https://github.com/ruby/observer
|
||||
abbrev 0.1.2 https://github.com/ruby/abbrev
|
||||
resolv-replace 0.1.1 https://github.com/ruby/resolv-replace
|
||||
|
||||
@ -31,16 +31,12 @@ describe "Kernel#BigDecimal" do
|
||||
end
|
||||
|
||||
it "accepts significant digits >= given precision" do
|
||||
suppress_warning do
|
||||
BigDecimal("3.1415923", 10).precs[1].should >= 10
|
||||
end
|
||||
BigDecimal("3.1415923", 10).should == BigDecimal("3.1415923")
|
||||
end
|
||||
|
||||
it "determines precision from initial value" do
|
||||
pi_string = "3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043"
|
||||
suppress_warning {
|
||||
BigDecimal(pi_string).precs[1]
|
||||
}.should >= pi_string.size-1
|
||||
BigDecimal(pi_string).precision.should == pi_string.size-1
|
||||
end
|
||||
|
||||
it "ignores leading and trailing whitespace" do
|
||||
@ -208,14 +204,6 @@ describe "Kernel#BigDecimal" do
|
||||
Float(@b).to_s.should == "166.66666666666666"
|
||||
end
|
||||
|
||||
it "has the expected precision on the LHS" do
|
||||
suppress_warning { @a.precs[0] }.should == 18
|
||||
end
|
||||
|
||||
it "has the expected maximum precision on the LHS" do
|
||||
suppress_warning { @a.precs[1] }.should == 27
|
||||
end
|
||||
|
||||
it "produces the expected result when done via Float" do
|
||||
(Float(@a) - Float(@b)).to_s.should == "-6.666596163995564e-10"
|
||||
end
|
||||
@ -226,34 +214,10 @@ describe "Kernel#BigDecimal" do
|
||||
|
||||
# Check underlying methods work as we understand
|
||||
|
||||
it "BigDecimal precision is the number of digits rounded up to a multiple of nine" do
|
||||
1.upto(100) do |n|
|
||||
b = BigDecimal('4' * n)
|
||||
precs, _ = suppress_warning { b.precs }
|
||||
(precs >= 9).should be_true
|
||||
(precs >= n).should be_true
|
||||
(precs % 9).should == 0
|
||||
end
|
||||
suppress_warning { BigDecimal('NaN').precs[0] }.should == 9
|
||||
end
|
||||
|
||||
it "BigDecimal maximum precision is nine more than precision except for abnormals" do
|
||||
1.upto(100) do |n|
|
||||
b = BigDecimal('4' * n)
|
||||
precs, max = suppress_warning { b.precs }
|
||||
max.should == precs + 9
|
||||
end
|
||||
suppress_warning { BigDecimal('NaN').precs[1] }.should == 9
|
||||
end
|
||||
|
||||
it "BigDecimal(Rational, 18) produces the result we expect" do
|
||||
BigDecimal(@b, 18).to_s.should == "0.166666666666666667e3"
|
||||
end
|
||||
|
||||
it "BigDecimal(Rational, BigDecimal.precs[0]) produces the result we expect" do
|
||||
BigDecimal(@b, suppress_warning { @a.precs[0] }).to_s.should == "0.166666666666666667e3"
|
||||
end
|
||||
|
||||
# Check the top-level expression works as we expect
|
||||
|
||||
it "produces a BigDecimal" do
|
||||
|
||||
@ -33,14 +33,16 @@ describe "BigDecimal#mod_part_of_divmod" do
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like :bigdecimal_modulo, :mod_part_of_divmod
|
||||
version_is BigDecimal::VERSION, ""..."4.0.0" do
|
||||
it_behaves_like :bigdecimal_modulo, :mod_part_of_divmod
|
||||
end
|
||||
|
||||
it "raises ZeroDivisionError if other is zero" do
|
||||
bd5667 = BigDecimal("5667.19")
|
||||
|
||||
zero = BigDecimal("0")
|
||||
-> { bd5667.mod_part_of_divmod(0) }.should raise_error(ZeroDivisionError)
|
||||
-> { bd5667.mod_part_of_divmod(BigDecimal("0")) }.should raise_error(ZeroDivisionError)
|
||||
-> { @zero.mod_part_of_divmod(@zero) }.should raise_error(ZeroDivisionError)
|
||||
-> { zero.mod_part_of_divmod(zero) }.should raise_error(ZeroDivisionError)
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,14 +75,25 @@ describe "BigDecimal#divmod" do
|
||||
@zeroes = [@zero, @zero_pos, @zero_neg]
|
||||
end
|
||||
|
||||
it "divides value, returns an array" do
|
||||
res = @a.divmod(5)
|
||||
res.kind_of?(Array).should == true
|
||||
version_is BigDecimal::VERSION, ""..."4.0.0" do
|
||||
it "divides value, returns [BigDecimal, BigDecimal]" do
|
||||
res = @a.divmod(5)
|
||||
res.kind_of?(Array).should == true
|
||||
DivmodSpecs.check_both_bigdecimal(res)
|
||||
end
|
||||
end
|
||||
|
||||
version_is BigDecimal::VERSION, "4.0.0" do
|
||||
it "divides value, returns [Integer, BigDecimal]" do
|
||||
res = @a.divmod(5)
|
||||
res.kind_of?(Array).should == true
|
||||
res[0].kind_of?(Integer).should == true
|
||||
res[1].kind_of?(BigDecimal).should == true
|
||||
end
|
||||
end
|
||||
|
||||
it "array contains quotient and modulus as BigDecimal" do
|
||||
res = @a.divmod(5)
|
||||
DivmodSpecs.check_both_bigdecimal(res)
|
||||
res[0].should == BigDecimal('0.8E1')
|
||||
res[1].should == BigDecimal('2.00000000000000000001')
|
||||
|
||||
@ -123,17 +136,27 @@ describe "BigDecimal#divmod" do
|
||||
values_and_zeroes.each do |val1|
|
||||
values.each do |val2|
|
||||
res = val1.divmod(val2)
|
||||
DivmodSpecs.check_both_bigdecimal(res)
|
||||
res[0].should == ((val1/val2).floor)
|
||||
res[1].should == (val1 - res[0] * val2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "returns an array of two NaNs if NaN is involved" do
|
||||
(@special_vals + @regular_vals + @zeroes).each do |val|
|
||||
DivmodSpecs.check_both_nan(val.divmod(@nan))
|
||||
DivmodSpecs.check_both_nan(@nan.divmod(val))
|
||||
version_is BigDecimal::VERSION, "4.0.0" do
|
||||
it "raise FloatDomainError error if NaN is involved" do
|
||||
(@special_vals + @regular_vals + @zeroes).each do |val|
|
||||
-> { val.divmod(@nan) }.should raise_error(FloatDomainError)
|
||||
-> { @nan.divmod(val) }.should raise_error(FloatDomainError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
version_is BigDecimal::VERSION, ""..."4.0.0" do
|
||||
it "returns an array of two NaNs if NaN is involved" do
|
||||
(@special_vals + @regular_vals + @zeroes).each do |val|
|
||||
DivmodSpecs.check_both_nan(val.divmod(@nan))
|
||||
DivmodSpecs.check_both_nan(@nan.divmod(val))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -145,12 +168,14 @@ describe "BigDecimal#divmod" do
|
||||
end
|
||||
end
|
||||
|
||||
it "returns an array of Infinity and NaN if the dividend is Infinity" do
|
||||
@regular_vals.each do |val|
|
||||
array = @infinity.divmod(val)
|
||||
array.length.should == 2
|
||||
array[0].infinite?.should == (val > 0 ? 1 : -1)
|
||||
array[1].should.nan?
|
||||
version_is BigDecimal::VERSION, ""..."4.0.0" do
|
||||
it "returns an array of Infinity and NaN if the dividend is Infinity" do
|
||||
@regular_vals.each do |val|
|
||||
array = @infinity.divmod(val)
|
||||
array.length.should == 2
|
||||
array[0].infinite?.should == (val > 0 ? 1 : -1)
|
||||
array[1].should.nan?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
require_relative '../../spec_helper'
|
||||
require 'bigdecimal'
|
||||
|
||||
describe "BigDecimal#precs" do
|
||||
before :each do
|
||||
@infinity = BigDecimal("Infinity")
|
||||
@infinity_neg = BigDecimal("-Infinity")
|
||||
@nan = BigDecimal("NaN")
|
||||
@zero = BigDecimal("0")
|
||||
@zero_neg = BigDecimal("-0")
|
||||
|
||||
@arr = [BigDecimal("2E40001"), BigDecimal("3E-20001"),\
|
||||
@infinity, @infinity_neg, @nan, @zero, @zero_neg]
|
||||
@precision = BigDecimal::BASE.to_s.length - 1
|
||||
end
|
||||
|
||||
it "returns array of two values" do
|
||||
suppress_warning do
|
||||
@arr.each do |x|
|
||||
x.precs.kind_of?(Array).should == true
|
||||
x.precs.size.should == 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "returns Integers as array values" do
|
||||
suppress_warning do
|
||||
@arr.each do |x|
|
||||
x.precs[0].kind_of?(Integer).should == true
|
||||
x.precs[1].kind_of?(Integer).should == true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "returns the current value of significant digits as the first value" do
|
||||
suppress_warning do
|
||||
BigDecimal("3.14159").precs[0].should >= 6
|
||||
BigDecimal('1').precs[0].should == BigDecimal('1' + '0' * 100).precs[0]
|
||||
[@infinity, @infinity_neg, @nan, @zero, @zero_neg].each do |value|
|
||||
value.precs[0].should <= @precision
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "returns the maximum number of significant digits as the second value" do
|
||||
suppress_warning do
|
||||
BigDecimal("3.14159").precs[1].should >= 6
|
||||
BigDecimal('1').precs[1].should >= 1
|
||||
BigDecimal('1' + '0' * 100).precs[1].should >= 101
|
||||
[@infinity, @infinity_neg, @nan, @zero, @zero_neg].each do |value|
|
||||
value.precs[1].should >= 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -46,53 +46,6 @@ test_new(RegexpSingletonTest)
|
||||
|
||||
## Failed tests caused by unreleased version of Ruby
|
||||
|
||||
# https://github.com/ruby/openssl/pull/774
|
||||
test_params(OpenSSLDHTest)
|
||||
|
||||
# RBS isn't compatible with RDoc 6.13
|
||||
RDocPluginParserTest
|
||||
|
||||
# https://github.com/ruby/json/pull/773
|
||||
test_load(JSONInstanceTest)
|
||||
test_load(JSONSingletonTest)
|
||||
|
||||
# https://github.com/ruby/json/pull/775
|
||||
test_fast_unparse(JSONInstanceTest)
|
||||
test_pretty_unparse(JSONInstanceTest)
|
||||
test_restore(JSONInstanceTest)
|
||||
test_unparse(JSONInstanceTest)
|
||||
test_fast_unparse(JSONSingletonTest)
|
||||
test_pretty_unparse(JSONSingletonTest)
|
||||
test_restore(JSONSingletonTest)
|
||||
test_unparse(JSONSingletonTest)
|
||||
|
||||
# https://github.com/ruby/json/pull/779
|
||||
test_iconv(JSONSingletonTest)
|
||||
|
||||
# https://github.com/ruby/json/pull/774
|
||||
test_recurse_proc(JSONInstanceTest)
|
||||
test_recurse_proc(JSONSingletonTest)
|
||||
|
||||
test_deep_const_get(JSONSingletonTest)
|
||||
|
||||
CGITest CGI is retired
|
||||
CGISingletonTest CGI is retired
|
||||
|
||||
RactorSingletonTest Ractor API was changed https://bugs.ruby-lang.org/issues/21262
|
||||
RactorInstanceTest Ractor API was changed https://bugs.ruby-lang.org/issues/21262
|
||||
|
||||
# https://github.com/ruby/fileutils/pull/139
|
||||
# https://github.com/ruby/actions/actions/runs/16425309325/job/46414287784
|
||||
test_ln_sr(FileUtilsSingletonTest)
|
||||
|
||||
# https://github.com/ruby/ruby/pull/14303
|
||||
# NoMethodError: undefined method 'respond_to?' for an instance of RBS::UnitTest::Convertibles::ToStr
|
||||
test_join(PathnameInstanceTest)
|
||||
test_plus(PathnameInstanceTest)
|
||||
test_relative_path_from(PathnameInstanceTest)
|
||||
test_slash(PathnameInstanceTest)
|
||||
test_Pathname(PathnameKernelTest)
|
||||
test_initialize(PathnameSingletonTest)
|
||||
|
||||
# [Feature #20925] `size` of Enumerator created by `produce` returns `nil` instead of `Float::INFINITY`, unless `size:` is specified.
|
||||
test_produce(EnumeratorSingletonTest)
|
||||
# BigDecimal v4.0.0 changed behavior
|
||||
test_divmod(BigDecimalTest)
|
||||
test_precs(BigDecimalTest)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user