diff --git a/Gemfile.lock b/Gemfile.lock index 739f47244..78481fc08 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GEM base64 (0.3.0) benchmark (0.5.0) benchmark-ips (2.14.0) - bigdecimal (3.3.1) + bigdecimal (4.0.0) concurrent-ruby (1.3.5) connection_pool (2.5.5) csv (3.3.5) @@ -56,9 +56,8 @@ GEM rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.17.1) - json-schema (6.0.0) + json-schema (5.1.0) addressable (~> 2.8) - bigdecimal (~> 3.1) language_server-protocol (3.17.0.5) lint_roller (1.1.0) listen (3.9.0) diff --git a/stdlib/bigdecimal-math/0/big_math.rbs b/stdlib/bigdecimal-math/0/big_math.rbs index 3c61d8f18..1fd2a0fc9 100644 --- a/stdlib/bigdecimal-math/0/big_math.rbs +++ b/stdlib/bigdecimal-math/0/big_math.rbs @@ -35,6 +35,46 @@ module BigMath # def self?.PI: (Numeric prec) -> BigDecimal + # Computes the arccosine of `decimal` to the specified number of digits of + # precision, `numeric`. + # + # If `decimal` is NaN, returns NaN. + # + # BigMath.acos(BigDecimal('0.5'), 32).to_s + # #=> "0.10471975511965977461542144610932e1" + # + def self?.acos: (BigDecimal, Numeric) -> BigDecimal + + # Computes the inverse hyperbolic cosine of `decimal` to the specified number of + # digits of precision, `numeric`. + # + # If `decimal` is NaN, returns NaN. + # + # BigMath.acosh(BigDecimal('2'), 32).to_s + # #=> "0.1316957896924816708625046347308e1" + # + def self?.acosh: (BigDecimal, Numeric) -> BigDecimal + + # Computes the arcsine of `decimal` to the specified number of digits of + # precision, `numeric`. + # + # If `decimal` is NaN, returns NaN. + # + # BigMath.asin(BigDecimal('0.5'), 32).to_s + # #=> "0.52359877559829887307710723054658e0" + # + def self?.asin: (BigDecimal, Numeric) -> BigDecimal + + # Computes the inverse hyperbolic sine of `decimal` to the specified number of + # digits of precision, `numeric`. + # + # If `decimal` is NaN, returns NaN. + # + # BigMath.asinh(BigDecimal('1'), 32).to_s + # #=> "0.88137358701954302523260932497979e0" + # + def self?.asinh: (BigDecimal, Numeric) -> BigDecimal + # + # Computes the hyperbolic cosine of `decimal` to the specified number of digits + # of precision, `numeric`. + # + # If `decimal` is NaN, returns NaN. + # + # BigMath.cosh(BigDecimal('1'), 32).to_s + # #=> "0.15430806348152437784779056207571e1" + # + def self?.cosh: (BigDecimal, Numeric) -> BigDecimal + + # Computes the error function of +decimal+ to the specified number of digits of + # precision, +numeric+. + # + # If +decimal+ is NaN, returns NaN. + # + # BigMath.erf(BigDecimal('1'), 32).to_s + # #=> "0.84270079294971486934122063508261e0" + # + def self?.erf: (BigDecimal, Numeric) -> BigDecimal + + # Computes the complementary error function of +decimal+ to the specified number of digits of + # precision, +numeric+. + # + # If +decimal+ is NaN, returns NaN. + # + # BigMath.erfc(BigDecimal('10'), 32).to_s + # #=> "0.20884875837625447570007862949578e-44" + # + def self?.erfc: (BigDecimal, Numeric) -> BigDecimal + # Computes the value of e (the base of natural logarithms) raised to the power # of `decimal`, to the specified number of digits of precision. # @@ -76,10 +168,45 @@ module BigMath # def self?.exp: (BigDecimal, Numeric prec) -> BigDecimal - # + # Decomposes +x+ into a normalized fraction and an integral power of ten. + # + # BigMath.frexp(BigDecimal(123.456)) + # #=> [0.123456e0, 3] + # + def self?.frexp: (BigDecimal) -> [ BigDecimal, Integer ] + + # Computes the gamma function of +decimal+ to the specified number of + # digits of precision, +numeric+. + # + # BigMath.gamma(BigDecimal('0.5'), 32).to_s + # #=> "0.17724538509055160272981674833411e1" + # + def self?.gamma: (BigDecimal, Numeric) -> BigDecimal + + # Returns sqrt(x**2 + y**2) to the specified number of digits of precision, + # `numeric`. + # + # BigMath.hypot(BigDecimal('1'), BigDecimal('2'), 32).to_s + # #=> "0.22360679774997896964091736687313e1" + # + def self?.hypot: (BigDecimal, BigDecimal, Numeric) -> BigDecimal + + # Inverse of +frexp+. + # Returns the value of fraction * 10**exponent. + # + # BigMath.ldexp(BigDecimal("0.123456e0"), 3) + # #=> 0.123456e3 + # + def self?.ldexp: (BigDecimal, Integer) -> BigDecimal + + # Computes the natural logarithm of the absolute value of the gamma function + # of +decimal+ to the specified number of digits of precision, +numeric+ and its sign. + # + # BigMath.lgamma(BigDecimal('0.5'), 32) + # #=> [0.57236494292470008707171367567653e0, 1] + # + def self?.lgamma: (BigDecimal, Numeric) -> [BigDecimal, Integer] + # Computes the natural logarithm of `decimal` to the specified number of digits # of precision, `numeric`. # @@ -91,6 +218,20 @@ module BigMath # def self?.log: (BigDecimal, Numeric prec) -> BigDecimal + # Computes the base 2 logarithm of `decimal` to the specified number of digits + # of precision, `numeric`. + # + # If `decimal` is zero or negative, raises Math::DomainError. + # + # If `decimal` is positive infinity, returns Infinity. + # + # If `decimal` is NaN, returns NaN. + # + # BigMath.log2(BigDecimal('3'), 32).to_s + # #=> "0.15849625007211561814537389439478e1" + # + def self?.log2: (BigDecimal, Numeric) -> BigDecimal + # - # Returns an Array of two Integer values that represent platform-dependent - # internal storage properties. - # - # This method is deprecated and will be removed in the future. Instead, use - # BigDecimal#n_significant_digits for obtaining the number of significant digits - # in scientific notation, and BigDecimal#precision for obtaining the number of - # digits in decimal notation. - # - def precs: () -> [ Integer, Integer ] - #