11件ヒット
[1-11件を表示]
(0.063秒)
種類
- モジュール関数 (6)
- インスタンスメソッド (5)
検索結果
先頭5件
-
Integer
# **(other) -> Numeric (54913.0) -
算術演算子。冪(べき乗)を計算します。
算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
... -
Integer
# pow(other) -> Numeric (9613.0) -
算術演算子。冪(べき乗)を計算します。
算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
... -
Integer
# pow(other , modulo) -> Integer (9613.0) -
算術演算子。冪(べき乗)を計算します。
算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
... -
Float
# round(ndigits = 0) -> Integer | Float (397.0) -
自身ともっとも近い整数もしくは実数を返します。
...1.0.round # => 1
1.2.round # => 1
(-1.2).round # => -1
(-1.5).round # => -2
t = Math::PI # => 3.141592653589793
t.round(3) # => 3.142
t.round(0) # => 3
t.round(1) # => 3.1
t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-2) #... -
Float
# round(ndigits = 0 , half: :up) -> Integer | Float (397.0) -
自身ともっとも近い整数もしくは実数を返します。
...1.0.round # => 1
1.2.round # => 1
(-1.2).round # => -1
(-1.5).round # => -2
t = Math::PI # => 3.141592653589793
t.round(3) # => 3.142
t.round(0) # => 3
t.round(1) # => 3.1
t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-2) #... -
Math
. # log(x) -> Float (361.0) -
x の対数(logarithm)を返します。
x の対数(logarithm)を返します。
引数 x, b の両方に 0 を指定した場合は Float::NAN を返します。
@param x 正の実数を指定します。
@param b 底を指定します。省略した場合は自然対数(natural logarithm)を計算します。
@raise TypeError 引数のどちらかに数値以外を指定した場合に発生します。
@raise RangeError 引数のどちらかに実数以外の数値を指定した場合に発生します。
@raise DomainError 引数のどちらかに負の数を指定した場合に発生します。
//emlist[例][ru... -
Math
. # log(x , b) -> Float (361.0) -
x の対数(logarithm)を返します。
x の対数(logarithm)を返します。
引数 x, b の両方に 0 を指定した場合は Float::NAN を返します。
@param x 正の実数を指定します。
@param b 底を指定します。省略した場合は自然対数(natural logarithm)を計算します。
@raise TypeError 引数のどちらかに数値以外を指定した場合に発生します。
@raise RangeError 引数のどちらかに実数以外の数値を指定した場合に発生します。
@raise DomainError 引数のどちらかに負の数を指定した場合に発生します。
//emlist[例][ru... -
Marshal
. # load(port , proc = nil) -> object (343.0) -
port からマーシャルデータを読み込んで、元のオブジェクトと同 じ状態をもつオブジェクトを生成します。
port からマーシャルデータを読み込んで、元のオブジェクトと同
じ状態をもつオブジェクトを生成します。
proc として手続きオブジェクトが与えられた場合には読み込んだ
オブジェクトを引数にその手続きを呼び出します。
//emlist[例][ruby]{
str = Marshal.dump(["a", 1, 10 ** 10, 1.0, :foo])
p Marshal.load(str, proc {|obj| p obj})
# => "a"
# 1
# 10000000000
# 1.0
# :foo
# ["a", 1, 10000000000... -
Marshal
. # restore(port , proc = nil) -> object (343.0) -
port からマーシャルデータを読み込んで、元のオブジェクトと同 じ状態をもつオブジェクトを生成します。
port からマーシャルデータを読み込んで、元のオブジェクトと同
じ状態をもつオブジェクトを生成します。
proc として手続きオブジェクトが与えられた場合には読み込んだ
オブジェクトを引数にその手続きを呼び出します。
//emlist[例][ruby]{
str = Marshal.dump(["a", 1, 10 ** 10, 1.0, :foo])
p Marshal.load(str, proc {|obj| p obj})
# => "a"
# 1
# 10000000000
# 1.0
# :foo
# ["a", 1, 10000000000... -
Math
. # frexp(x) -> [Float , Integer] (343.0) -
実数 x の仮数部と指数部の配列を返します。
実数 x の仮数部と指数部の配列を返します。
@param x 実数
@raise TypeError x に数値以外を指定した場合に発生します。
@raise RangeError x に実数以外の数値を指定した場合に発生します。
//emlist[例][ruby]{
fraction, exponent = Math.frexp(1234) # => [0.6025390625, 11]
fraction * 2**exponent # => 1234.0
//} -
Math
. # log10(x) -> Float (343.0) -
x の常用対数(common logarithm)を返します。
x の常用対数(common logarithm)を返します。
@param x 正の実数
@raise TypeError xに数値以外を指定した場合に発生します。
@raise Math::DomainError x に範囲外の実数を指定した場合に発生します。
@raise RangeError xに実数以外の数値を指定した場合に発生します。
//emlist[例][ruby]{
Math.log10(1) # => 0.0
Math.log10(10) # => 1.0
Math.log10(10**100) # => 100.0
//}
@see M...