るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.127秒)
トップページ > バージョン:2.3.0[x] > 種類:インスタンスメソッド[x] > クエリ:l[x] > クエリ:y[x] > クラス:BigDecimal[x]

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

ライブラリ

キーワード

検索結果

BigDecimal#split -> [Integer, String, Integer, Integer] (18361.0)

BigDecimal 値を 0.xxxxxxx*10**n と表現したときに、 符号 (NaNのときは 0、それ以外は+1か-1になります)、 仮数部分の文字列("xxxxxxx")と、基数(10)、更に指数 n を配列で返します。

...
BigDecimal
値を 0.xxxxxxx*10**n と表現したときに、
符号 (NaNのときは 0、それ以外は+1か-1になります)、
仮数部分の文字列("xxxxxxx")と、基数(10)、更に指数 n を配列で返します。

//emlist[][ruby]{
require "bigdecimal"
a = BigDecimal("3.14159265")
f...
..., x, y, z = a.split
//}

とすると、f = 1、x = "314159265"、y = 10、z = 1 になります。
従って、以下のようにする事で Float に変換することができます。

//emlist[][ruby]{
s = "0."+x
b = f*(s.to_f)*(y**z)
//}

@see BigDecimal#to_f...

BigDecimal#coerce(other) -> Array (9307.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 を有...