180件ヒット
[1-100件を表示]
(0.130秒)
ライブラリ
- ビルトイン (158)
- bigdecimal (22)
検索結果
先頭5件
-
Bignum
# modulo(other) -> Fixnum | Bignum | Float (18302.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Fixnum
# modulo(other) -> Fixnum | Bignum | Float (18302.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Numeric
# modulo(other) -> Numeric (18244.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... -
Integer
# modulo(other) -> Numeric (18202.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
BigDecimal
# modulo(n) -> BigDecimal (15232.0) -
self を n で割った余りを返します。
...self を n で割った余りを返します。
@param n self を割る数を指定します。
//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 を参照して下さい。... -
Bignum
# remainder(other) -> Fixnum | Bignum | Float (6113.0) -
self を other で割った余り r を返します。
...self を other で割った余り r を返します。
r の符号は self と同じになります。
@param other self を割る数。
@see Bignum#divmod, Bignum#modulo, Numeric#modulo... -
Integer
# remainder(other) -> Numeric (6113.0) -
self を other で割った余り r を返します。
.../emlist[][ruby]{
5.remainder(3) # => 2
-5.remainder(3) # => -2
5.remainder(-3) # => 2
-5.remainder(-3) # => -2
-1234567890987654321.remainder(13731) # => -6966
-1234567890987654321.remainder(13731.24) # => -9906.22531493148
//}
@see Integer#divmod, Integer#modulo, Numeric#modulo... -
Numeric
# remainder(other) -> Numeric (6107.0) -
self を other で割った余り r を返します。
...ther).truncate がそれに相当します。
@param other 自身を割る数を指定します。
//emlist[例][ruby]{
p 13.remainder(4) #=> 1
p (11.5).remainder(3.5) #=> 1.0
p 13.remainder(-4) #=> 1
p (-13).remainder(4) #=> -1
p (-13).remainder(-4) #=> -1
p (-11).remainder(3.5)......#=> -0.5
//}
@see Numeric#divmod, Numeric#modulo... -
Integer
# pow(other , modulo) -> Integer (3214.0) -
算術演算子。冪(べき乗)を計算します。
...の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で ot......整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#powe... -
Bignum
# %(other) -> Fixnum | Bignum | Float (3202.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Fixnum
# %(other) -> Fixnum | Bignum | Float (3202.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Numeric
# %(other) -> Numeric (3144.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... -
Integer
# **(other) -> Numeric (3114.0) -
算術演算子。冪(べき乗)を計算します。
...の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で ot......整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#powe...