Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > bigdecimal/mathライブラリ
BigDecimalを使った数学的な機能を提供します。
以下の計算が行えます。
引数:
計算対象の BigDecimal オブジェクト。
計算結果の精度。
require "bigdecimal"
require "bigdecimal/math"
include BigMath
a = BigDecimal((PI(100)/2).to_s)
puts sin(a,100)
#=> 0.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998765917571575217785e0
BigMath.#E
BigMath.#PI
BigMath.#atan
BigMath.#cos
BigMath.#sin
BigMath.#sqrt