るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.077秒)

別のキーワード

  1. bigdecimal/util to_d
  2. bigdecimal round
  3. bigdecimal mode
  4. bigdecimal div
  5. bigdecimal to_s

ライブラリ

クラス

検索結果

BigDecimal#add(other, n) -> BigDecimal (105664.0)

和を計算します。

和を計算します。

self + other を最大で n 桁まで計算します。計算結果の精度が n より大きい
ときは BigDecimal.mode で指定された方法で丸められます。

@param other self に足す数を指定します。

@param n 有効桁数を整数で指定します。0 を指定した場合は
BigDecimal#+ と同じ値を返します。

@raise ArgumentError n に負の数を指定した場合に発生します。

@see BigDecimal#+

BigDecimal#to_json(*args) -> String (27076.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 使用しません。

//emlist[例][ruby]{
require 'json/add/bigdecimal'
BigDecimal('0.123456789123456789').to_json # => "{\"json_class\":\"BigDecimal\",\"b\":\"36:0.123456789123456789e0\"}"
//...