instance method Integer#**
self ** other -> Rational | Float | Integer
[redefined by rational]-
冪(べき)乗を計算します。
- [PARAM] other:
- 自身を other 乗する数
計算結果は以下のようになります。
- otherが正または0の整数(Integer)ならば、整数(Integer)を返す。
- otherが負の整数(Integer)ならば、有理数(Rational)を返す。
- otherが有理数(Rational)や浮動小数(Float)ならば、浮動小数(Float)を返す。
例:
2 ** 3 #=> 8 2 ** -3 #=> Rational(1, 8) 2 ** Rational(3) #=> 8.0 2 ** Rational(1, 2) #=> 1.4142135623731
class Integer