るりまサーチ

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. bigdecimal to_r
  5. fileutils cp_r

ライブラリ

クラス

検索結果

Rational#**(other) -> Rational | Float (42474.0)

冪(べき)乗を計算します。

...

@param other 自身を other 乗する数

other に Float を指定した場合は、計算結果を Float で返しま
す。other が有理数であっても、計算結果が無理数だった場合は Float
を返します。

//emlist[例][ruby]{
r
= Rational(3, 4)
r
** Rational(2, 1) #...
...=> (9/16)
r
** 2 # => (9/16)
r
** 2.0 # => 0.5625
r
** Rational(1, 2) # => 0.866025403784439
//}...

Rational#**(rhs) -> Numeric (42313.0)

@todo

...@todo

self のべき乗を返します。 Rational になるようであれば Rational で返します。...

Rational#to_f -> Float (24191.0)

自身の値を最も良く表現する 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
//}...