るりまサーチ

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

検索結果

Rational#to_f -> Float (18274.0)

自身の値を最も良く表現する Float に変換します。

... Float に変換します。

絶対値が極端に小さい、または大きい場合にはゼロや無限大が返ることがあります。

@return Float を返します。

//emlist[例][ruby]{
Rational
(2).to_f # => 2.0
Rational
(9, 4).to_f # => 2.25
Rational
(-3, 4).to_f...
...# => -0.75
Rational
(20, 3).to_f # => 6.666666666666667
Rational
(1, 10**1000).to_f # => 0.0
Rational
(-1, 10**1000).to_f # => -0.0
Rational
(10**1000).to_f # => Infinity
Rational
(-10**1000).to_f # => -Infinity
//}...