262件ヒット
[1-100件を表示]
(0.076秒)
検索結果
先頭5件
-
Integer
# -(other) -> Numeric (21310.0) -
算術演算子。差を計算します。
...算術演算子。差を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[][ruby]{
4 - 1 #=> 3
//}... -
Integer
# remainder(other) -> Numeric (9358.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#modul... -
Integer
# fdiv(other) -> Numeric (6340.0) -
self を other で割った商を Float で返します。 ただし Complex が関わる場合は例外です。 その場合も成分は Float になります。
...指定します。
例:
654321.fdiv(13731) # => 47.652829364212366
654321.fdiv(13731.24) # => 47.65199646936475
-1234567890987654321.fdiv(13731) # => -89910996357705.52
-1234567890987654321.fdiv(13731.24) # => -89909424858035.72
@see Numeric#quo, Numeric#div, Integer#div... -
Integer
# divmod(other) -> [Integer , Numeric] (6310.0) -
self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にし て返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。
...self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にし
て返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。
@param other self を割る数。
@see Numeric#divmod... -
Integer
# ceil(ndigits = 0) -> Integer (6215.0) -
self と等しいかより大きな整数のうち最小のものを返します。
...digits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[][ruby]{
1.ceil # => 1
1.ceil(2) # => 1
18.ceil(-1) # => 20
(-......18).ceil(-1) # => -10
//}
@see Numeric#ceil... -
Integer
# ceil(ndigits = 0) -> Integer | Float (6215.0) -
self と等しいかより大きな整数のうち最小のものを返します。
...@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返し......ます。
小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[][ruby]{
1.ceil # => 1
1.ceil(2) # => 1.0
18.ceil(-1) # => 20
(-18).ceil(-1) # => -10
//}
@see Numeric#ceil... -
Integer
# times -> Enumerator (6215.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...f - 1 までの数値が渡されます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see Integer#upto, I......nteger#downto, Numeric#step... -
Integer
# times {|n| . . . } -> self (6215.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...f - 1 までの数値が渡されます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see Integer#upto, I......nteger#downto, Numeric#step... -
Integer
# **(other) -> Numeric (3365.0) -
算術演算子。冪(べき乗)を計算します。
...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... -
Integer
# pow(other) -> Numeric (3365.0) -
算術演算子。冪(べき乗)を計算します。
...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... -
Integer
# %(other) -> Numeric (3341.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}
@param other 二項演算の右側の引数(対象)
@return 計算結果...