ライブラリ
クラス
モジュール
オブジェクト
-
Readline
:: HISTORY (12)
キーワード
- % (24)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - Lazy (12)
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Numeric (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- [] (39)
- abs (12)
- abs2 (12)
- bigdecimal (12)
-
bit
_ length (18) - create (22)
- encode (36)
-
enum
_ for (24) - exp! (6)
- expires (12)
-
fiddle
/ import (12) -
for
_ fd (12) - format (12)
- frexp (12)
- getrlimit (12)
- inject (36)
-
int
_ from _ prime _ division (12) - irb (12)
- lazy (12)
- load (12)
- log (24)
- log10 (12)
- magnitude (12)
-
max
_ by (48) -
mod
_ exp (12) -
mod
_ sqr (12) - modulo (12)
- new (26)
- open (46)
- parameters (24)
-
parse
_ csv (12) - pipe (96)
- pow (24)
- power (24)
-
prime
_ division (36) - read (36)
- realtime (12)
- reduce (36)
- remainder (12)
- restore (12)
- round (21)
-
ruby 1
. 6 feature (12) -
ruby 1
. 9 feature (12) -
ruby
_ stack _ length (12) -
set
_ encoding (36) - split (12)
- sprintf (12)
- sprintf フォーマット (12)
- sqrt (8)
-
st
_ delete (12) -
st
_ delete _ safe (12) -
st
_ lookup (12) - then (14)
- timeout (21)
-
to
_ csv (12) -
to
_ enum (24) -
to
_ f (12) -
to
_ h (14) - uniq (24)
- with (3)
- write (36)
-
yield
_ self (16) - クラス/メソッドの定義 (12)
- パターンマッチ (12)
- 演算子式 (12)
検索結果
先頭5件
-
Integer
# **(other) -> Numeric (18136.0) -
算術演算子。冪(べき乗)を計算します。
...elf**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0......# => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}
結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を......放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#power......します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生......合に発生します。
@raise ArgumentError 計算結果が巨大になりすぎる場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) #......=> -7
//}
計算結果が巨大すぎるときは ArgumentError が発生します。
//emlist[計算結果が巨大すぎる例][ruby]{
p 100**9999999999999999999
# => exponent is too large (ArgumentError)
//}
判定の閾値は変わりえます。
@see BigDecimal#power... -
Rational
# **(other) -> Rational | Float (18124.0) -
冪(べき)乗を計算します。
...す。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
//}... -
Bignum
# **(other) -> Fixnum | Bignum | Float (18118.0) -
算術演算子。冪(べき乗)を計算します。
...算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1... -
Fixnum
# **(other) -> Fixnum | Bignum | Float (18118.0) -
算術演算子。冪(べき乗)を計算します。
...算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1... -
Float
# **(other) -> Float (18118.0) -
算術演算子。冪を計算します。
...算術演算子。冪を計算します。
@param other 二項演算の右側の引数(対象)
//emlist[例][ruby]{
# 冪
1.2 ** 3.0 # => 1.7279999999999998
3.0 + 4.5 - 1.3 / 2.4 * 3 % 1.2 ** 3.0 # => 5.875
0.0 ** 0 # => 1.0
//}... -
Complex
# **(other) -> Complex (18106.0) -
冪(べき)乗を計算します。
...冪(べき)乗を計算します。
@param other 自身を other 乗する数
//emlist[例][ruby]{
Complex('i') ** 2 # => (-1+0i)
//}... -
BigDecimal
# **(n) -> BigDecimal (18100.0) -
self の n 乗を計算します。
self の n 乗を計算します。
戻り値の有効桁数は self の有効桁数の n 倍以上になります。
@param n selfを other 乗する数を指定します。
@param prec 有効桁数を整数で指定します。self の n 乗を計算します。
戻り値の有効桁数は self の有効桁数の n 倍以上になります。
@param n selfを other 乗する数を指定します。
@param prec 有効桁数を整数で指定します。
@see Integer#pow -
Matrix
# **(n) -> Matrix (18100.0) -
self の n 乗を返します。
self の n 乗を返します。
@param n べき数の指定
@raise ExceptionForMatrix::ErrNotRegular n が 0 以下で、行列が正則でない場合に発生します -
OpenSSL
:: BN # **(other) -> OpenSSL :: BN (18100.0) -
自身の other 乗を返します。
自身の other 乗を返します。
@param other 指数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#mod_exp -
Rational
# **(rhs) -> Numeric (18100.0) -
@todo
@todo
self のべき乗を返します。 Rational になるようであれば Rational で返します。 -
Integer
# pow(other) -> Numeric (3036.0) -
算術演算子。冪(べき乗)を計算します。
...elf**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0......# => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}
結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を......放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#power...