種類
- インスタンスメソッド (803)
- 特異メソッド (43)
ライブラリ
- ビルトイン (768)
-
bigdecimal
/ util (11) - mathn (1)
- openssl (11)
- prime (55)
キーワード
- % (11)
- & (11)
- * (11)
- ** (11)
- + (11)
- - (11)
- -@ (11)
-
/ (11) - < (11)
- << (11)
- <= (11)
- <=> (11)
- == (11)
- === (11)
- > (11)
- >= (11)
- >> (11)
- [] (21)
- ^ (11)
- abs (11)
- allbits? (7)
- anybits? (7)
-
bit
_ length (11) - ceil (11)
- ceildiv (2)
- chr (22)
- denominator (11)
- digits (22)
- div (11)
- divmod (11)
- downto (22)
-
each
_ prime (22) - even? (11)
- fdiv (11)
- floor (11)
-
from
_ prime _ division (11) - gcd (11)
- gcdlcm (11)
- inspect (11)
- integer? (11)
- lcm (11)
- magnitude (11)
- modulo (11)
- next (11)
- nobits? (7)
- numerator (11)
- odd? (11)
- ord (11)
- pow (22)
- pred (11)
- prime? (11)
-
prime
_ division (11) - rationalize (22)
- remainder (11)
- round (11)
- size (11)
- sqrt (7)
- succ (11)
- times (22)
-
to
_ bn (11) -
to
_ d (11) -
to
_ f (11) -
to
_ i (11) -
to
_ int (11) -
to
_ r (11) -
to
_ s (11) - truncate (11)
-
try
_ convert (3) - upto (22)
- | (11)
- ~ (11)
検索結果
先頭5件
-
Integer
# to _ f -> Float (1.0) -
self を浮動小数点数(Float)に変換します。
self を浮動小数点数(Float)に変換します。
self が Float の範囲に収まらない場合、Float::INFINITY を返します。
//emlist[][ruby]{
1.to_f # => 1.0
(Float::MAX.to_i * 2).to_f # => Infinity
(-Float::MAX.to_i * 2).to_f # => -Infinity
//} -
Integer
# to _ i -> self (1.0) -
self を返します。
self を返します。
//emlist[][ruby]{
10.to_i # => 10
//} -
Integer
# to _ int -> self (1.0) -
self を返します。
self を返します。
//emlist[][ruby]{
10.to_i # => 10
//} -
Integer
# to _ r -> Rational (1.0) -
自身を Rational に変換します。
自身を Rational に変換します。
//emlist[][ruby]{
1.to_r # => (1/1)
(1<<64).to_r # => (18446744073709551616/1)
//} -
Integer
# to _ s(base=10) -> String (1.0) -
整数を 10 進文字列表現に変換します。
整数を 10 進文字列表現に変換します。
引数を指定すれば、それを基数とした文字列表
現に変換します。
//emlist[][ruby]{
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
# truncate(ndigits = 0) -> Integer (1.0) -
0 から self までの整数で、自身にもっとも近い整数を返します。
0 から self までの整数で、自身にもっとも近い整数を返します。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}
@see Numeric#truncate -
Integer
# truncate(ndigits = 0) -> Integer | Float (1.0) -
0 から self までの整数で、自身にもっとも近い整数を返します。
...合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。
//emlist[][ruby]{
1.truncate... -
Integer
# upto(max) -> Enumerator (1.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
# upto(max) {|n| . . . } -> Integer (1.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
# |(other) -> Integer (1.0) -
ビット二項演算子。論理和を計算します。
ビット二項演算子。論理和を計算します。
@param other 数値
//emlist[][ruby]{
1 | 1 # => 1
2 | 3 # => 3
//} -
Integer
# ~ -> Integer (1.0) -
ビット演算子。否定を計算します。
ビット演算子。否定を計算します。
//emlist[][ruby]{
~1 # => -2
~3 # => -4
~-4 # => 3
//}