るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.021秒)
トップページ > バージョン:2.4.0[x] > クエリ:Rational[x] > クラス:BigDecimal[x]

別のキーワード

  1. _builtin rational
  2. rational **
  3. json/add/rational to_json
  4. json/add/rational json_create
  5. rational /

ライブラリ

キーワード

検索結果

BigDecimal#to_r -> Rational (355.0)

self を Rational オブジェクトに変換します。

self を Rational オブジェクトに変換します。

BigDecimal#coerce(other) -> Array (22.0)

self と other が同じクラスになるよう、self か other を変換し [other, self] という配列にして返します。

...ェクト

BigDecimal
#coerce は Ruby における強制型変換のための機能です。
BigDecimal
オブジェクトとその他のオブジェクト間の各種の計算は
BigDecimal
#coerce の結果を元に行われます。

//emlist[][ruby]{
require "bigdecimal"
a = BigDecimal("1.0")
b =...
...に Rational オブジェクトを指定した場合は self の有効桁数を
用いて変換を行います。

数値を表す文字列から BigDecimal オブジェクトに変換する機能はデフォ
ルトでは無効になっています。必要な場合は ENABLE_NUMERIC_STRING を有...