@@ -35,6 +35,46 @@ module BigMath
3535 #
3636 def self?.PI : (Numeric prec) -> BigDecimal
3737
38+ # Computes the arccosine of `decimal` to the specified number of digits of
39+ # precision, `numeric`.
40+ #
41+ # If `decimal` is NaN, returns NaN.
42+ #
43+ # BigMath.acos(BigDecimal('0.5'), 32).to_s
44+ # #=> "0.10471975511965977461542144610932e1"
45+ #
46+ def self?.acos : (BigDecimal, Numeric) -> BigDecimal
47+
48+ # Computes the inverse hyperbolic cosine of `decimal` to the specified number of
49+ # digits of precision, `numeric`.
50+ #
51+ # If `decimal` is NaN, returns NaN.
52+ #
53+ # BigMath.acosh(BigDecimal('2'), 32).to_s
54+ # #=> "0.1316957896924816708625046347308e1"
55+ #
56+ def self?.acosh : (BigDecimal, Numeric) -> BigDecimal
57+
58+ # Computes the arcsine of `decimal` to the specified number of digits of
59+ # precision, `numeric`.
60+ #
61+ # If `decimal` is NaN, returns NaN.
62+ #
63+ # BigMath.asin(BigDecimal('0.5'), 32).to_s
64+ # #=> "0.52359877559829887307710723054658e0"
65+ #
66+ def self?.asin : (BigDecimal, Numeric) -> BigDecimal
67+
68+ # Computes the inverse hyperbolic sine of `decimal` to the specified number of
69+ # digits of precision, `numeric`.
70+ #
71+ # If `decimal` is NaN, returns NaN.
72+ #
73+ # BigMath.asinh(BigDecimal('1'), 32).to_s
74+ # #=> "0.88137358701954302523260932497979e0"
75+ #
76+ def self?.asinh : (BigDecimal, Numeric) -> BigDecimal
77+
3878 # <!--
3979 # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
4080 # - atan(decimal, numeric) -> BigDecimal
@@ -49,6 +89,32 @@ module BigMath
4989 #
5090 def self?.atan : (BigDecimal x, Numeric prec) -> BigDecimal
5191
92+ # Computes the arctangent of y and x to the specified number of digits of
93+ # precision, `numeric`.
94+ #
95+ # BigMath.atan2(BigDecimal('-1'), BigDecimal('1'), 32).to_s
96+ # #=> "-0.78539816339744830961566084581988e0"
97+ #
98+ def self?.atan2 : (BigDecimal, BigDecimal, Numeric) -> BigDecimal
99+
100+ # Computes the inverse hyperbolic tangent of `decimal` to the specified number
101+ # of digits of precision, `numeric`.
102+ #
103+ # If `decimal` is NaN, returns NaN.
104+ #
105+ # BigMath.atanh(BigDecimal('0.5'), 32).to_s
106+ # #=> "0.54930614433405484569762261846126e0"
107+ #
108+ def self?.atanh : (BigDecimal, Numeric) -> BigDecimal
109+
110+ # Computes the cube root of `decimal` to the specified number of digits of
111+ # precision, `numeric`.
112+ #
113+ # BigMath.cbrt(BigDecimal('2'), 32).to_s
114+ # #=> "0.12599210498948731647672106072782e1"
115+ #
116+ def self?.cbrt : (BigDecimal, Numeric) -> BigDecimal
117+
52118 # <!--
53119 # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
54120 # - cos(decimal, numeric) -> BigDecimal
@@ -63,10 +129,36 @@ module BigMath
63129 #
64130 def self?.cos : (BigDecimal x, Numeric prec) -> BigDecimal
65131
66- # <!--
67- # rdoc-file=ext/bigdecimal/bigdecimal.c
68- # - BigMath.exp(decimal, numeric) -> BigDecimal
69- # -->
132+ # Computes the hyperbolic cosine of `decimal` to the specified number of digits
133+ # of precision, `numeric`.
134+ #
135+ # If `decimal` is NaN, returns NaN.
136+ #
137+ # BigMath.cosh(BigDecimal('1'), 32).to_s
138+ # #=> "0.15430806348152437784779056207571e1"
139+ #
140+ def self?.cosh : (BigDecimal, Numeric) -> BigDecimal
141+
142+ # Computes the error function of +decimal+ to the specified number of digits of
143+ # precision, +numeric+.
144+ #
145+ # If +decimal+ is NaN, returns NaN.
146+ #
147+ # BigMath.erf(BigDecimal('1'), 32).to_s
148+ # #=> "0.84270079294971486934122063508261e0"
149+ #
150+ def self?.erf : (BigDecimal, Numeric) -> BigDecimal
151+
152+ # Computes the complementary error function of +decimal+ to the specified number of digits of
153+ # precision, +numeric+.
154+ #
155+ # If +decimal+ is NaN, returns NaN.
156+ #
157+ # BigMath.erfc(BigDecimal('10'), 32).to_s
158+ # #=> "0.20884875837625447570007862949578e-44"
159+ #
160+ def self?.erfc : (BigDecimal, Numeric) -> BigDecimal
161+
70162 # Computes the value of e (the base of natural logarithms) raised to the power
71163 # of `decimal`, to the specified number of digits of precision.
72164 #
@@ -76,10 +168,45 @@ module BigMath
76168 #
77169 def self?.exp : (BigDecimal, Numeric prec) -> BigDecimal
78170
79- # <!--
80- # rdoc-file=ext/bigdecimal/bigdecimal.c
81- # - BigMath.log(decimal, numeric) -> BigDecimal
82- # -->
171+ # Decomposes +x+ into a normalized fraction and an integral power of ten.
172+ #
173+ # BigMath.frexp(BigDecimal(123.456))
174+ # #=> [0.123456e0, 3]
175+ #
176+ def self?.frexp : (BigDecimal) -> [ BigDecimal, Integer ]
177+
178+ # Computes the gamma function of +decimal+ to the specified number of
179+ # digits of precision, +numeric+.
180+ #
181+ # BigMath.gamma(BigDecimal('0.5'), 32).to_s
182+ # #=> "0.17724538509055160272981674833411e1"
183+ #
184+ def self?.gamma : (BigDecimal, Numeric) -> BigDecimal
185+
186+ # Returns sqrt(x**2 + y**2) to the specified number of digits of precision,
187+ # `numeric`.
188+ #
189+ # BigMath.hypot(BigDecimal('1'), BigDecimal('2'), 32).to_s
190+ # #=> "0.22360679774997896964091736687313e1"
191+ #
192+ def self?.hypot : (BigDecimal, BigDecimal, Numeric) -> BigDecimal
193+
194+ # Inverse of +frexp+.
195+ # Returns the value of fraction * 10**exponent.
196+ #
197+ # BigMath.ldexp(BigDecimal("0.123456e0"), 3)
198+ # #=> 0.123456e3
199+ #
200+ def self?.ldexp : (BigDecimal, Integer) -> BigDecimal
201+
202+ # Computes the natural logarithm of the absolute value of the gamma function
203+ # of +decimal+ to the specified number of digits of precision, +numeric+ and its sign.
204+ #
205+ # BigMath.lgamma(BigDecimal('0.5'), 32)
206+ # #=> [0.57236494292470008707171367567653e0, 1]
207+ #
208+ def self?.lgamma : (BigDecimal, Numeric) -> [BigDecimal, Integer]
209+
83210 # Computes the natural logarithm of `decimal` to the specified number of digits
84211 # of precision, `numeric`.
85212 #
@@ -91,6 +218,20 @@ module BigMath
91218 #
92219 def self?.log : (BigDecimal, Numeric prec) -> BigDecimal
93220
221+ # Computes the base 2 logarithm of `decimal` to the specified number of digits
222+ # of precision, `numeric`.
223+ #
224+ # If `decimal` is zero or negative, raises Math::DomainError.
225+ #
226+ # If `decimal` is positive infinity, returns Infinity.
227+ #
228+ # If `decimal` is NaN, returns NaN.
229+ #
230+ # BigMath.log2(BigDecimal('3'), 32).to_s
231+ # #=> "0.15849625007211561814537389439478e1"
232+ #
233+ def self?.log2 : (BigDecimal, Numeric) -> BigDecimal
234+
94235 # <!--
95236 # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
96237 # - sin(decimal, numeric) -> BigDecimal
@@ -105,6 +246,16 @@ module BigMath
105246 #
106247 def self?.sin : (BigDecimal x, Numeric prec) -> BigDecimal
107248
249+ # Computes the hyperbolic sine of `decimal` to the specified number of digits of
250+ # precision, `numeric`.
251+ #
252+ # If `decimal` is NaN, returns NaN.
253+ #
254+ # BigMath.sinh(BigDecimal('1'), 32).to_s
255+ # #=> "0.11752011936438014568823818505956e1"
256+ #
257+ def self?.sinh : (BigDecimal, Numeric) -> BigDecimal
258+
108259 # <!--
109260 # rdoc-file=ext/bigdecimal/lib/bigdecimal/math.rb
110261 # - sqrt(decimal, numeric) -> BigDecimal
@@ -116,4 +267,14 @@ module BigMath
116267 # #=> "0.1414213562373095048801688724e1"
117268 #
118269 def self?.sqrt : (BigDecimal x, Numeric prec) -> BigDecimal
270+
271+ # Computes the hyperbolic tangent of `decimal` to the specified number of digits
272+ # of precision, `numeric`.
273+ #
274+ # If `decimal` is NaN, returns NaN.
275+ #
276+ # BigMath.tanh(BigDecimal('1'), 32).to_s
277+ # #=> "0.76159415595576488811945828260479e0"
278+ #
279+ def self?.tanh : (BigDecimal, Numeric) -> BigDecimal
119280end
0 commit comments