るりまサーチ

最速Rubyリファレンスマニュアル検索!
846件ヒット [1-100件を表示] (0.151秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クラス:Integer[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Integer#-(other) -> Numeric (21207.0)

算術演算子。差を計算します。

...算術演算子。差を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

//emlist[][ruby]{
4 - 1 #=> 3
//}...

Integer#-@ -> Integer (9241.0)

単項演算子の - です。 self の符号を反転させたものを返します。

...単項演算子の - です。
self の符号を反転させたものを返します。

//emlist[][ruby]{
-
10 # => -10
-
-10 # => 10
//}...

Integer#denominator -> Integer (6307.0)

分母(常に1)を返します。

...分母(常に1)を返します。

@return 分母を返します。

//emlist[][ruby]{
10.denominator # => 1
-
10.denominator # => 1
//}

@see Integer#numerator...

Integer#prime_division(generator = Prime::Generator23.new) -> [[Integer, Integer]] (6301.0)

自身を素因数分解した結果を返します。

...自身を素因数分解した結果を返します。

@param generator 素数生成器のインスタンスを指定します。

@return 素因数とその指数から成るペアを要素とする配列です。つまり、戻り値の各要素は2要素の配列 [n,e] であり、それぞれ...
...、第2要素は n**e が self を割り切る最大の自然数 e です。

@raise ZeroDivisionError self がゼロである場合に発生します。

@see Prime#prime_division

//emlist[例][ruby]{
r
equire 'prime'
12.prime_division #=> [[2,2], [3,1]]
10.prime_division #=> [[2,1], [5,1]]
//}...

Integer#rationalize -> Rational (6301.0)

自身を Rational に変換します。

...自身を Rational に変換します。

@param eps 許容する誤差

引数 eps は常に無視されます。

//emlist[][ruby]{
2.rationalize # => (2/1)
2.rationalize(100) # => (2/1)
2.rationalize(0.1) # => (2/1)
//}...

絞り込み条件を変える

Integer#rationalize(eps) -> Rational (6301.0)

自身を Rational に変換します。

...自身を Rational に変換します。

@param eps 許容する誤差

引数 eps は常に無視されます。

//emlist[][ruby]{
2.rationalize # => (2/1)
2.rationalize(100) # => (2/1)
2.rationalize(0.1) # => (2/1)
//}...

Integer.each_prime(upper_bound) {|prime| ... } -> object (6301.0)

全ての素数を列挙し、それぞれの素数をブロックに渡して評価します。

...れの素数をブロックに渡して評価します。

@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@return ブロックの最後に評価された値を返します。...
...ブロックが与えられなかった場合は、Enumerator と互換性のある外部イテレータを返します。

@see Prime#each...

Integer#remainder(other) -> Numeric (6271.0)

self を other で割った余り r を返します。

...er で割った余り r を返します。

r
の符号は self と同じになります。

@param other self を割る数。

//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...

Integer#round(ndigits = 0, half: :up) -> Integer (6225.0)

self ともっとも近い整数を返します。

...とも近い整数を返します。

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
@param half ちょうど半分の値の丸め方...
...* :up or nil: 0から遠い方に丸められます。
* :even: もっとも近い偶数に丸められます。
* :down: 0に近い方に丸められます。

//emlist[][ruby]{
1.round # => 1
1.round(2) # => 1
15.round(-1) # => 20
(-15).round(-1) # => -20

25.round(-1, half:...
...25.round(-1, half: :down) # => 20
25.round(-1, half: :even) # => 20
35.round(-1, half: :up) # => 40
35.round(-1, half: :down) # => 30
35.round(-1, half: :even) # => 40
(-25).round(-1, half: :up) # => -30
(-25).round(-1, half: :down) # => -20
(-25).round(-1, half: :even) # => -20...

Integer#round(ndigits = 0, half: :up) -> Integer | Float (6225.0)

self ともっとも近い整数を返します。

...

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...
...小数点位置から左に少なくとも n 個の 0 が並びます。
@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。

* :up or nil: 0から遠い方に丸められます。
* :even: もっとも近い偶...
...[][ruby]{
1.round # => 1
1.round(2) # => 1.0
15.round(-1) # => 20
(-15).round(-1) # => -20

25.round(-1, half: :up) # => 30
25.round(-1, half: :down) # => 20
25.round(-1, half: :even) # => 20
35.round(-1, half: :up) # => 40
35.round(-1, half: :down) # => 30
35.rou...

絞り込み条件を変える

Integer#pred -> Integer (6223.0)

self から -1 した値を返します。

...self から -1 した値を返します。

//emlist[][ruby]{
1.pred #=> 0
(-1).pred #=> -2
//}

@see Integer#next...
<< 1 2 3 ... > >>