231件ヒット
[1-100件を表示]
(0.065秒)
種類
- インスタンスメソッド (219)
- 文書 (12)
ライブラリ
- ビルトイン (195)
- bigdecimal (24)
検索結果
先頭5件
-
Numeric
# modulo(other) -> Numeric (15155.0) -
self を other で割った余り r を返します。
...ます。
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
# modulo(other) -> Fixnum | Bignum | Float (15113.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Fixnum
# modulo(other) -> Fixnum | Bignum | Float (15113.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Integer
# modulo(other) -> Numeric (15113.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
BigDecimal
# modulo(n) -> BigDecimal (15107.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 と同じ符号にな... -
Float
# modulo(other) -> Float (15107.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//}... -
Integer
# pow(other , modulo) -> Integer (155.0) -
算術演算子。冪(べき乗)を計算します。
...算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以......になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#power......外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
@raise ArgumentError 計算結果が巨大になりすぎる場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3,......> -3
5.pow(2, -8) # => -7
//}
計算結果が巨大すぎるときは ArgumentError が発生します。
//emlist[計算結果が巨大すぎる例][ruby]{
p 100**9999999999999999999
# => exponent is too large (ArgumentError)
//}
判定の閾値は変わりえます。
@see BigDecimal#power... -
ruby 1
. 6 feature (60.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...>))
Object.new.instance_eval {
p remove_instance_variable :@foo
}
=> ruby 1.6.7 (2002-03-01) [i586-linux]
nil
=> -:2:in `remove_instance_variable': instance variable @foo not defined (NameError)
ruby 1.6.7 (2002-04-10) [i586-linux]
:......わることはなくなりました。((<ruby-dev:17876>))
class Foo
FOO = 1
@@foo = 1
end
FOO = 2
@@foo = 2
Foo.module_eval { p FOO, @@foo }
=> ruby 1.6.7 (2002-03-01) [i586-linux]
1
1
=> ruby 1.......1.6.3 (2001-04-03) [i586-linux]
-1073741824
# => ruby 1.6.4 (2001-04-19) [i586-linux]
1073741824
: ((<Float>))#modulo, ((<Float>))#divmod
なんか修正されたみたいです ((<ruby-dev:12718>))
: ((<ObjectSpace>))#_id2ref
不正に例外を返す場合... -
Integer
# **(other) -> Numeric (55.0) -
算術演算子。冪(べき乗)を計算します。
...算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以......外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
@raise ArgumentError 計算結果が巨大になりすぎる場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3,......> -3
5.pow(2, -8) # => -7
//}
計算結果が巨大すぎるときは ArgumentError が発生します。
//emlist[計算結果が巨大すぎる例][ruby]{
p 100**9999999999999999999
# => exponent is too large (ArgumentError)
//}
判定の閾値は変わりえます。
@see BigDecimal#power... -
Integer
# pow(other) -> Numeric (55.0) -
算術演算子。冪(べき乗)を計算します。
...算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以......外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
@raise ArgumentError 計算結果が巨大になりすぎる場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3,......> -3
5.pow(2, -8) # => -7
//}
計算結果が巨大すぎるときは ArgumentError が発生します。
//emlist[計算結果が巨大すぎる例][ruby]{
p 100**9999999999999999999
# => exponent is too large (ArgumentError)
//}
判定の閾値は変わりえます。
@see BigDecimal#power... -
Numeric
# %(other) -> Numeric (55.0) -
self を other で割った余り r を返します。
...ます。
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 (49.0) -
算術演算子。冪(べき乗)を計算します。
...算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以......になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#power...