種類
- インスタンスメソッド (33)
- 特異メソッド (3)
ライブラリ
- ビルトイン (19)
- mathn (3)
- openssl (1)
- rational (9)
-
yaml
/ rubytypes (4)
キーワード
- ** (1)
-
/ (1) - chr (1)
- denominator (1)
- downto (2)
- even? (1)
-
from
_ prime _ division (1) - gcd (1)
- gcd2 (1)
- gcdlcm (1)
-
induced
_ from (1) - integer? (1)
- lcm (1)
- next (1)
- numerator (1)
- odd? (1)
- ord (1)
- power! (1)
- pred (1)
-
prime
_ division (1) - succ (1)
- taguri (1)
- taguri= (1)
- times (2)
-
to
_ bn (1) -
to
_ i (1) -
to
_ int (1) -
to
_ r (1) -
to
_ s (2) -
to
_ yaml (1) - upto (2)
-
yaml
_ tag _ subclasses? (1)
検索結果
先頭5件
-
Integer
# **(other) -> Rational | Float | Integer (2) -
冪(べき)乗を計算します。
...を other 乗する数
計算結果は以下のようになります。
* otherが正または0の整数(Integer)ならば、整数(Integer)を返す。
* otherが負の整数(Integer)ならば、有理数(Rational)を返す。
* otherが有理数(Rational)や浮動小数(Float)ならば、... -
Integer
# / (other) -> Rational | Float | Integer (2) -
商を計算します。
...* otherが有理数(Rational)ならば、有理数(Rational)を返す。
* otherがそれ以外なら、Integer#/と同じ。つまり、
other が整数(Integer)ならば、整数(Integer)を(整除)、浮動小数(Float)ならば、
浮動小数(Float)を返す。
ただし、いず... -
Integer
# chr -> String (2) -
文字コードに対応する 1 バイトの文字列を返します。
文字コードに対応する 1 バイトの文字列を返します。
例えば65.chr は "A" を返します。
逆に文字列から文字コードを得るには "A"[0] とします
@return 1バイト文字列
@raise RangeError self が 0 から 255 の範囲外の場合に発生します。
@see String#[] -
Integer
# denominator -> Integer (2) -
分母(常に1)を返します。
...分母(常に1)を返します。
@return 分母を返します。
@see Integer#numerator... -
Integer
# downto(min) -> Enumerable :: Enumerator (2) -
self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。
...し実行します。
self < min であれば何もしません。
@param min 数値
@return self を返します。
@see Integer#upto, Numeric#step, Integer#times... -
Integer
# downto(min) {|n| . . . } -> self (2) -
self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。
...し実行します。
self < min であれば何もしません。
@param min 数値
@return self を返します。
@see Integer#upto, Numeric#step, Integer#times... -
Integer
# even? -> bool (2) -
自身が偶数であれば真を返します。 そうでない場合は偽を返します。
自身が偶数であれば真を返します。
そうでない場合は偽を返します。 -
Integer
# gcd(n) -> Integer (2) -
自身と整数 n の最大公約数を返します。
...# => 1
3.gcd(-7) # => 1
((1<<31)-1).gcd((1<<61)-1) # => 1
また、self や n が 0 だった場合は、0 ではない方の整数の絶対値を返します。
3.gcd(0) # => 3
0.gcd(-7) # => 7
@see Integer#lcm, Integer#gcdlcm... -
Integer
# gcd2(int) (2) -
@todo
@todo
例:
12.gcd2 8
# => 4 -
Integer
# gcdlcm(n) -> [Integer] (2) -
自身と整数 n の最大公約数と最小公倍数の配列 [self.gcd(n), self.lcm(n)] を返します。
...以外のものを指定すると発生します。
例:
6.gcdlcm(9) # => [3, 18]
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
# integer? -> true (2) -
常に真を返します。
常に真を返します。 -
Integer
# lcm(n) -> Integer (2) -
自身と整数 n の最小公倍数を返します。
...# => 2
3.lcm(-7) # => 21
((1<<31)-1).lcm((1<<61)-1) # => 4951760154835678088235319297
また、self や n が 0 だった場合は、0 を返します。
3.lcm(0) # => 0
0.lcm(-7) # => 0
@see Integer#gcd, Integer#gcdlcm... -
Integer
# next -> Fixnum | Bignum (2) -
self の次の整数を返します。
self の次の整数を返します。 -
Integer
# numerator -> Integer (2) -
分子(常に自身)を返します。
...分子(常に自身)を返します。
@return 分子を返します。
@see Integer#denominator... -
Integer
# odd? -> bool (2) -
自身が奇数であれば真を返します。 そうでない場合は偽を返します。
自身が奇数であれば真を返します。
そうでない場合は偽を返します。 -
Integer
# ord -> Integer (2) -
自身を返します。
自身を返します。
10.ord #=> 10
?a.ord #=> 97 -
Integer
# power!(other) -> Integer | Float (2) -
冪(べき)乗を計算します。
...計算します。
@param other 自身を other 乗する数
rationalで再定義される前のInteger#**の別名です。
other が正または 0 の整数 (Integer) ならば、整数 (Integer) を、それ以外
なら、浮動小数 (Float) を返します。... -
Integer
# pred -> Integer (2) -
self から -1 した値を返します。
self から -1 した値を返します。
1.pred #=> 0
(-1).pred #=> -2 -
Integer
# prime _ division (2) -
@todo
@todo
各素因子について素因子と指数の組を並べた配列を返します。
例:
72.prime_division
# => [[2, 3], [3, 2]] -
Integer
# succ -> Fixnum | Bignum (2) -
self の次の整数を返します。
self の次の整数を返します。 -
Integer
# taguri -> String (2) -
自身のタグ URI を返します。
自身のタグ URI を返します。 -
Integer
# taguri=(val) (2) -
自身のタグ URI を val に設定します。
自身のタグ URI を val に設定します。
@param val タグ URI を文字列で指定します。 -
Integer
# times -> Enumerable :: Enumerator (2) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...数値が渡されます。
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
@see Integer#upto, Integer#downto, Numeric#step... -
Integer
# times {|n| . . . } -> self (2) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...数値が渡されます。
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
@see Integer#upto, Integer#downto, Numeric#step... -
Integer
# to _ bn -> OpenSSL :: BN (2) -
Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。
...Integer を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。
現在のバージョンでは正しく実装されていません。... -
Integer
# to _ i -> self (2) -
self を返します。
self を返します。 -
Integer
# to _ int -> self (2) -
self を返します。
self を返します。 -
Integer
# to _ r -> Rational (2) -
自身を Rational に変換します。
自身を Rational に変換します。
例:
1.to_r # => Rational(1, 1)
(1<<64).to_r # => Rational(18446744073709551616, 1) -
Integer
# to _ s -> String (2) -
整数を 10 進文字列表現に変換します。
整数を 10 進文字列表現に変換します。
引数を指定すれば、それを基数とした文字列表
現に変換します。
p 10.to_s(2) # => "1010"
p 10.to_s(8) # => "12"
p 10.to_s(16) # => "a"
p 35.to_s(36) # => "z"
@return 数値の文字列表現
@param base 基数となる 2 - 36 の数値。
@raise ArgumentError base に 2 - 36 以外の数値を指定した場合に発生します。 -
Integer
# to _ s(base) -> String (2) -
整数を 10 進文字列表現に変換します。
整数を 10 進文字列表現に変換します。
引数を指定すれば、それを基数とした文字列表
現に変換します。
p 10.to_s(2) # => "1010"
p 10.to_s(8) # => "12"
p 10.to_s(16) # => "a"
p 35.to_s(36) # => "z"
@return 数値の文字列表現
@param base 基数となる 2 - 36 の数値。
@raise ArgumentError base に 2 - 36 以外の数値を指定した場合に発生します。 -
Integer
# to _ yaml(opts = {}) (2) -
自身を YAML ドキュメントに変換します。
自身を YAML ドキュメントに変換します。
@param opts YAML ドキュメント出力の際のオプションを指定します。
オプションの詳細は YAML::Syck::Emitter#reset を参照し
てください。
print 1.to_yaml # => --- 1
print -1.to_yaml # => --- -1 -
Integer
# upto(max) -> Enumerable :: Enumerator (2) -
self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。
...繰り返します。
self > max であれば何もしません。
@param max 数値
@return self を返します。
@see Integer#downto, Numeric#step, Integer#times... -
Integer
# upto(max) {|n| . . . } -> Fixnum | Bignum (2) -
self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。
...繰り返します。
self > max であれば何もしません。
@param max 数値
@return self を返します。
@see Integer#downto, Numeric#step, Integer#times... -
Integer
. from _ prime _ division(pd) -> Integer (2) -
素因数分解の配列 pd から数を求めます。 pd は [素因数, 指数] 組の配列です。
...素因数分解の配列 pd から数を求めます。
pd は [素因数, 指数] 組の配列です。
例:
Integer.from_prime_division [[2,3],[3,2]]
# => 72 == 2**3 * 3**2... -
Integer
. induced _ from(num) -> Integer (2) -
num を Integer に変換した結果を返します。 引数が数値の場合は小数部が切り捨てられ、そうでない場合はTypeErrorをraiseします。
...num を Integer に変換した結果を返します。
引数が数値の場合は小数部が切り捨てられ、そうでない場合はTypeErrorをraiseします。
Integer.induced_from 1.4 #=> 1
Integer.induced_from 1.9 #=> 1
Integer.induced_from -1.9 #=> -1
Integer.induced_from '1... -
Integer
. yaml _ tag _ subclasses? -> true (2) -
常に true を返します。
常に true を返します。
ライブラリ内部で使用します。
