927件ヒット
[1-100件を表示]
(0.017秒)
別のキーワード
種類
- インスタンスメソッド (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)
- [] (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
# >(other) -> bool (18113.0) -
比較演算子。数値として大きいか判定します。
...演算子。数値として大きいか判定します。
@param other 比較対象の数値
@return self よりも other の方が小さい場合 true を返します。
そうでなければ false を返します。
//emlist[][ruby]{
1 > 0 # => true
1 > 1 # => false
//}... -
Integer
# <=>(other) -> -1 | 0 | 1 | nil (6101.0) -
self と other を比較して、self が大きい時に1、等しい時に 0、小さい時 に-1、比較できない時に nil を返します。
...、self が大きい時に1、等しい時に 0、小さい時
に-1、比較できない時に nil を返します。
@param other 比較対象の数値
@return -1 か 0 か 1 か nil のいずれか
//emlist[][ruby]{
1 <=> 2 # => -1
1 <=> 1 # => 0
2 <=> 1 # => 1
2 <=> '' # => nil
//}... -
Integer
# >=(other) -> bool (6101.0) -
比較演算子。数値として等しいまたは大きいか判定します。
...other 比較対象の数値
@return self よりも other の方が小さい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[][ruby]{
1 >= 0 # => true
1 >= 1 # => true
1 >= 2 # => false
//}... -
Integer
# >>(bits) -> Integer (6101.0) -
シフト演算子。bits だけビットを右にシフトします。
...、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
//emlist[][ruby]{
printf("%#b\n", 0b0101 >> 1) # => 0b10
p -1 >> 1 # => -1
//}... -
Integer
# upto(max) -> Enumerator (117.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 (117.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
# chr -> String (113.0) -
self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。
...ncoding に対応する文字を返します。
//emlist[][ruby]{
p 65.chr
# => "A"
p 12354.chr
# => `chr': 12354 out of char range (RangeError)
p 12354.chr(Encoding::UTF_8)
# => "あ"
p 12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}
引数無しで呼ばれ......ト内部エンコーディングの順で優先的に解釈します。
//emlist[][ruby]{
p 0x79.chr.encoding # => #<Encoding:US_ASCII>
p 0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}
@param encoding エンコーディングを表すオブジェクト。Encoding::UTF_8、'shift_jis' など。... -
Integer
# chr(encoding) -> String (113.0) -
self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。
...ncoding に対応する文字を返します。
//emlist[][ruby]{
p 65.chr
# => "A"
p 12354.chr
# => `chr': 12354 out of char range (RangeError)
p 12354.chr(Encoding::UTF_8)
# => "あ"
p 12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}
引数無しで呼ばれ......ト内部エンコーディングの順で優先的に解釈します。
//emlist[][ruby]{
p 0x79.chr.encoding # => #<Encoding:US_ASCII>
p 0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}
@param encoding エンコーディングを表すオブジェクト。Encoding::UTF_8、'shift_jis' など。... -
Integer
# div(other) -> Integer (113.0) -
整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
...ther が Integer オブジェクトの場合、Integer#/ の結果と一致します。
div に対応する剰余メソッドは modulo です。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[例][ruby]{
7.div(2) # => 3
7.div(-2) # => -4
7.div(2.0) # => 3
7.div......)) # => 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#modu...