Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

BigMath#sqrt

sqrt(decimal, numeric) → BigDecimal

Computes the square root of decimal to the specified number of digits of precision, numeric.

Example
BigMath.sqrt(BigDecimal('2'), 16).to_s
#=> "0.1414213562373095048801688724e1"
See also #sin #PI also in 3.3 · 3.2 · 3.1