879件ヒット
[1-100件を表示]
(0.087秒)
ライブラリ
- ビルトイン (830)
-
bigdecimal
/ util (12) - mathn (1)
- openssl (12)
- prime (24)
キーワード
- % (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)
- even? (12)
- fdiv (12)
- floor (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)
- 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)
- upto (24)
- | (12)
- ~ (12)
検索結果
先頭5件
-
Integer
# integer? -> true (15115.0) -
常に真を返します。
...常に真を返します。
//emlist[][ruby]{
1.integer? # => true
1.0.integer? # => false
//}... -
Integer
# prime _ division(generator = Prime :: Generator23 . new) -> [[Integer , Integer]] (9204.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.p... -
Integer
# div(other) -> Integer (9139.0) -
整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
...ます。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
other が Integer オブジェクトの場合、Integer#/ の結果と一致します。
div に対応する剰余メソッドは modulo です。
@param other 二項演算の右側......=> 3
begin
2.div(0)
rescue => e
e # => #<ZeroDivisionError: divided by 0>
end
begin
2.div(0.0)
rescue => e
e # => #<ZeroDivisionError: divided by 0>
# Integer#/ と違い、引数が Float でもゼロで割ることはできない
end
//}
@see Integer#fdiv, Integer#/, Integer#modulo... -
Integer
# gcd(n) -> Integer (9115.0) -
自身と整数 n の最大公約数を返します。
...7) # => 1
((1<<31)-1).gcd((1<<61)-1) # => 1
//}
また、self や n が 0 だった場合は、0 ではない方の整数の絶対値を返します。
//emlist[][ruby]{
3.gcd(0) # => 3
0.gcd(-7) # => 7
//}
@see Integer#lcm, Integer#gcdlcm... -
Integer
# gcdlcm(n) -> [Integer] (9115.0) -
自身と整数 n の最大公約数と最小公倍数の配列 [self.gcd(n), self.lcm(n)] を返します。
...@raise ArgumentError n に整数以外のものを指定すると発生します。
//emlist[][ruby]{
2.gcdlcm(2) # => [2, 2]
3.gcdlcm(-7) # => [1, 21]
((1<<31)-1).gcdlcm((1<<61)-1) # => [1, 4951760154835678088235319297]
//}
@see Integer#gcd, Integer#lcm... -
Integer
# lcm(n) -> Integer (9115.0) -
自身と整数 n の最小公倍数を返します。
...3.lcm(-7) # => 21
((1<<31)-1).lcm((1<<61)-1) # => 4951760154835678088235319297
//}
また、self や n が 0 だった場合は、0 を返します。
//emlist[][ruby]{
3.lcm(0) # => 0
0.lcm(-7) # => 0
//}
@see Integer#gcd, Integer#gcdlcm... -
Integer
# upto(max) {|n| . . . } -> Integer (9115.0) -
self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。
...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。
@param max 数値
@return self を返します。
//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}
@see Integer#downto, Numeric#step, Integer#times... -
Integer
# next -> Integer (9110.0) -
self の次の整数を返します。
...self の次の整数を返します。
//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}
@see Integer#pred... -
Integer
# succ -> Integer (9110.0) -
self の次の整数を返します。
...self の次の整数を返します。
//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}
@see Integer#pred...