Ruby 4.1 リファレンスマニュアル

instance method Integer#**

self ** other -> Numeric[permalink][rdoc][edit]
(Integer) → Numeric
(Float) → Numeric
(Rational) → Numeric
(Complex) → Complex

selfother 乗を返します。

Integer オブジェクトを左項とする算術演算子 ** はこのメソッドの呼び出しになります。

[PARAM] other:
self に対する冪指数(べきしすう)
[EXCEPTION] ArgumentError:
計算結果が巨大になりすぎる場合に発生します。
p 2 ** 3 # => 8
p 2 ** 0 # => 1
p 0 ** 0 # => 1

計算結果が巨大すぎるときは ArgumentError が発生します。

計算結果が巨大すぎる例
p 100**9999999999999999999
# => exponent is too large (ArgumentError)

判定の閾値は変わりえます。

[SEE_ALSO] BigDecimal#power, Integer#pow