るりまサーチ

最速Rubyリファレンスマニュアル検索!
722件ヒット [201-300件を表示] (0.201秒)
トップページ > クエリ:t[x] > クエリ:r[x] > 種類:インスタンスメソッド[x] > クエリ:ruby[x] > クエリ:@[x] > クラス:Integer[x]

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

Integer#to_s(base=10) -> String (9226.0)

整数を 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#upto(max) {|n| ... } -> Integer (9226.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#floor(ndigits = 0) -> Integer (9220.0)

self と等しいかより小さな整数のうち最大のものを返します。

...

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.floor # => 1
1.floor(2) # => 1
18.floor(-1)...
...# => 10
(-18).floor(-1) # => -20
//}

@
see Numeric#floor...

Integer#floor(ndigits = 0) -> Integer | Float (9220.0)

self と等しいかより小さな整数のうち最大のものを返します。

...

@
param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...
...します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.floor # => 1
1.floor(2) # => 1.0
18.floor(-1) # => 10
(-18).floor(-1) # => -20
//}

@
see Numeric#floor...

Integer#bit_length -> Integer (9214.0)

self を表すのに必要なビット数を返します。

...//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...

絞り込み条件を変える

Integer#next -> Integer (9214.0)

self の次の整数を返します。

...self の次の整数を返します。

//emlist[][ruby]{
1.next #=> 2
(-1).next #=> 0
1.succ #=> 2
(-1).succ #=> 0
//}

@
see Integer#pred...

Integer#ord -> Integer (9214.0)

自身を返します。

...自身を返します。

//emlist[][ruby]{
10.ord #=> 10
# String#ord
?a.ord #=> 97
//}

@
see String#ord...

Integer#pred -> Integer (9214.0)

self から -1 した値を返します。

...self から -1 した値を返します。

//emlist[][ruby]{
1.pred #=> 0
(-1).pred #=> -2
//}

@
see Integer#next...

Integer#times -> Enumerator (9214.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...れます。

//emlist[][ruby]{
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#allbits?(mask) -> bool (9126.0)

self & mask の全てのビットが 1 なら true を返します。

... true を返します。

self & mask == mask と等価です。

@
param mask ビットマスクを整数で指定します。

//emlist[][ruby]{
42.allbits?(42) # => true
0b1010_1010.allbits?(0b1000_0010) # => true
0b1010_1010.allbits?(0b1000_0001) # => false
0b1000_0010.allbits?(...
...0b1010_1010) # => false
//}

@
see Integer#anybits?
@
see Integer#nobits?...

絞り込み条件を変える

Integer#anybits?(mask) -> bool (9126.0)

self & mask のいずれかのビットが 1 なら true を返します。

... true を返します。

self & mask != 0 と等価です。

@
param mask ビットマスクを整数で指定します。

//emlist[][ruby]{
42.anybits?(42) # => true
0b1010_1010.anybits?(0b1000_0010) # => true
0b1010_1010.anybits?(0b1000_0001) # => true
0b1000_0010.anybits?(0...
...b0010_1100) # => false
//}

@
see Integer#allbits?
@
see Integer#nobits?...
<< < 1 2 3 4 5 ... > >>