155件ヒット
[1-100件を表示]
(0.117秒)
種類
- インスタンスメソッド (133)
- 文書 (11)
- クラス (11)
ライブラリ
- ビルトイン (122)
- bigdecimal (22)
キーワード
- ** (11)
- Numeric (11)
- divmod (22)
- pow (22)
-
ruby 1
. 6 feature (11)
検索結果
先頭5件
-
Integer
# %(other) -> Numeric (41225.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Integer
# modulo(other) -> Numeric (41225.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Integer
# pow(other , modulo) -> Integer (23219.0) -
算術演算子。冪(べき乗)を計算します。
...側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で......//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... -
Integer
# **(other) -> Numeric (23119.0) -
算術演算子。冪(べき乗)を計算します。
...側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で......//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... -
Integer
# pow(other) -> Numeric (23119.0) -
算術演算子。冪(べき乗)を計算します。
...側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で......//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... -
BigDecimal
# %(n) -> BigDecimal (21249.0) -
self を n で割った余りを返します。
...る数を指定します。
//emlist[][ruby]{
require 'bigdecimal'
x = BigDecimal((2**100).to_s)
( x % 3).to_i # => 1
(-x % 3).to_i # => 2
( x % -3).to_i # => -2
(-x % -3).to_i # => -1
//}
戻り値は n と同じ符号になります。これは BigDecimal#remainder とは
異なる点に注意......してください。詳細は Numeric#%、
Numeric#remainder を参照して下さい。... -
BigDecimal
# modulo(n) -> BigDecimal (21249.0) -
self を n で割った余りを返します。
...る数を指定します。
//emlist[][ruby]{
require 'bigdecimal'
x = BigDecimal((2**100).to_s)
( x % 3).to_i # => 1
(-x % 3).to_i # => 2
( x % -3).to_i # => -2
(-x % -3).to_i # => -1
//}
戻り値は n と同じ符号になります。これは BigDecimal#remainder とは
異なる点に注意......してください。詳細は Numeric#%、
Numeric#remainder を参照して下さい。... -
Numeric
# %(other) -> Numeric (21249.0) -
self を other で割った余り r を返します。
...q は、Numeric#div (あるいは 「/」)で求められます。
modulo はメソッド % の呼び出しとして定義されています。
@param other 自身を割る数を指定します。
//emlist[例][ruby]{
p 13.modulo(4) #=> 1
p (11.5).modulo(3.5) #=> 1.0
p 13.modulo(-4) #=......> -3
p (-13).modulo(4) #=> 3
p (-13).modulo(-4) #=> -1
p (-11).modulo(3.5) #=> 3.0
//}
@see Numeric#divmod, Numeric#remainder... -
Numeric
# modulo(other) -> Numeric (21249.0) -
self を other で割った余り r を返します。
...q は、Numeric#div (あるいは 「/」)で求められます。
modulo はメソッド % の呼び出しとして定義されています。
@param other 自身を割る数を指定します。
//emlist[例][ruby]{
p 13.modulo(4) #=> 1
p (11.5).modulo(3.5) #=> 1.0
p 13.modulo(-4) #=......> -3
p (-13).modulo(4) #=> 3
p (-13).modulo(-4) #=> -1
p (-11).modulo(3.5) #=> 3.0
//}
@see Numeric#divmod, Numeric#remainder... -
Bignum
# %(other) -> Fixnum | Bignum | Float (21201.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果