927件ヒット
[1-100件を表示]
(0.093秒)
種類
- インスタンスメソッド (879)
- 特異メソッド (48)
ライブラリ
- ビルトイン (842)
-
bigdecimal
/ util (12) - mathn (1)
- openssl (12)
- prime (60)
キーワード
- % (12)
- & (12)
- * (12)
- ** (12)
- + (12)
- - (12)
- -@ (12)
-
/ (12) - < (12)
- << (12)
- <= (12)
- <=> (12)
- == (12)
- === (12)
- > (12)
- >= (12)
- >> (12)
- [] (24)
- ^ (12)
- abs (12)
- allbits? (8)
- anybits? (8)
-
bit
_ length (12) - ceil (12)
- ceildiv (3)
- chr (24)
- denominator (12)
- digits (24)
- div (12)
- divmod (12)
- downto (24)
-
each
_ prime (24) - even? (12)
- fdiv (12)
- floor (12)
-
from
_ prime _ division (12) - gcd (12)
- gcdlcm (12)
- inspect (12)
- integer? (12)
- lcm (12)
- magnitude (12)
- modulo (12)
- next (12)
- nobits? (8)
- numerator (12)
- odd? (12)
- ord (12)
- pow (24)
- pred (12)
- prime? (12)
-
prime
_ division (12) - rationalize (24)
- remainder (12)
- round (12)
- size (12)
- sqrt (8)
- succ (12)
- times (24)
-
to
_ bn (12) -
to
_ d (12) -
to
_ f (12) -
to
_ i (12) -
to
_ int (12) -
to
_ r (12) -
to
_ s (12) - truncate (12)
-
try
_ convert (4) - upto (24)
- | (12)
- ~ (12)
検索結果
先頭5件
-
Integer
# downto(min) -> Enumerator (9102.0) -
self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。
...min まで 1 ずつ減らしながらブロックを繰り返し実行します。
self < min であれば何もしません。
@param min 数値
@return self を返します。
//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}
@see Integer#upto, Numeric#step, Integer#t... -
Integer
# downto(min) {|n| . . . } -> self (9102.0) -
self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。
...min まで 1 ずつ減らしながらブロックを繰り返し実行します。
self < min であれば何もしません。
@param min 数値
@return self を返します。
//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}
@see Integer#upto, Numeric#step, Integer#t... -
Integer
# integer? -> true (9101.0) -
常に真を返します。
...常に真を返します。
//emlist[][ruby]{
1.integer? # => true
1.0.integer? # => false
//}... -
Integer
# round(ndigits = 0 , half: :up) -> Integer | Float (6213.0) -
self ともっとも近い整数を返します。
...@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返し......も n 個の 0 が並びます。
@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。
* :up or nil: 0から遠い方に丸められます。
* :even: もっとも近い偶数に丸められます。
* :down: 0に......{
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.round(-1, h... -
Integer
# round(ndigits = 0 , half: :up) -> Integer (6207.0) -
self ともっとも近い整数を返します。
...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:......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.round(-1, half: :even) # => 40
(-25).round(-1, half: :up) # => -30
(-25).round(-1, half: :down) # => -20
(-25).round(-1, half: :even) # => -2... -
Integer
# rationalize -> Rational (6201.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 (6201.0) -
自身を Rational に変換します。
...自身を Rational に変換します。
@param eps 許容する誤差
引数 eps は常に無視されます。
//emlist[][ruby]{
2.rationalize # => (2/1)
2.rationalize(100) # => (2/1)
2.rationalize(0.1) # => (2/1)
//}... -
Integer
# to _ bn -> OpenSSL :: BN (6201.0) -
Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。
...
Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。
//emlist[][ruby]{
require 'pp'
require 'openssl'
pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}
なお、実装は、以下のようになっています。
//emlist[][ruby]{
clas......s Integer
def to_bn
OpenSSL::BN::new(self)
end
end
//}
@see OpenSSL::BN.new, OpenSSL::BN#to_i......
Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。
//emlist[][ruby]{
require 'openssl'
pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}
なお、実装は、以下のようになっています。
//emlist[][ruby]{
class Integer
d......ef to_bn
OpenSSL::BN::new(self)
end
end
//}
@see OpenSSL::BN.new, OpenSSL::BN#to_i... -
Integer
# prime _ division(generator = Prime :: Generator23 . new) -> [[Integer , Integer]] (6119.0) -
自身を素因数分解した結果を返します。
...す。
@param generator 素数生成器のインスタンスを指定します。
@return 素因数とその指数から成るペアを要素とする配列です。つまり、戻り値の各要素は2要素の配列 [n,e] であり、それぞれの内部配列の第1要素 n は self の素因......数、第2要素は n**e が self を割り切る最大の自然数 e です。
@raise ZeroDivisionError self がゼロである場合に発生します。
@see Prime#prime_division
//emlist[例][ruby]{
require 'prime'
12.prime_division #=> [[2,2], [3,1]]
10.prime_division #=> [[2,1], [5,1]]
//}... -
Integer
# bit _ length -> Integer (6113.0) -
self を表すのに必要なビット数を返します。
...。2**n の場合は n+1 になります。self にそのようなビットがない(0 や
-1 である)場合は 0 を返します。
//emlist[例: ceil(log2(int < 0 ? -int : int+1)) と同じ結果][ruby]{
(-2**12-1).bit_length # => 13
(-2**12).bit_length # => 12
(-2**12+1).bit_length......> 12
-0x101.bit_length # => 9
-0x100.bit_length # => 8
-0xff.bit_length # => 8
-2.bit_length # => 1
-1.bit_length # => 0
0.bit_length # => 0
1.bit_length # => 1
0xff.bit_length # => 8
0x100.bit_length # =>......9
(2**12-1).bit_length # => 12
(2**12).bit_length # => 13
(2**12+1).bit_length # => 13
//}
@see Integer#size...