るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.136秒)
トップページ > クエリ:i[x] > クエリ:l[x] > クエリ:require[x] > クラス:Rational[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

ライブラリ

キーワード

検索結果

Rational#to_d(nFig) -> BigDecimal (6313.0)

自身を BigDecimal に変換します。

...BigDecimal に変換します。

nFig 桁まで計算を行います。

@param nFig 計算を行う桁数

@return BigDecimal に変換したオブジェクト

@raise ArgumentError nFig に 0 以下を指定した場合に発生します。

//emlist[][ruby]{
require
"bigdecimal"
require
"bigdeci...
...mal/util"
p Rational(1, 3).to_d(3) # => 0.333e0
p Rational(1, 3).to_d(10) # => 0.3333333333e0
//}...

Rational#to_json(*args) -> String (6107.0)

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

...JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 使用しません。

//emlist[例][ruby]{
require
'json/add/rational'
Rational
(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...
...@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json
に渡されます。

//emlist[例][ruby]{
require
'json/add/rational'
Rational
(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...