るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < ... 4 5 6 7 8 > >>

Integer#numerator -> Integer (26.0)

分子(常に自身)を返します。

...分子(常に自身)を返します。

@
return 分子を返します。

//emlist[][ruby]{
10.numerator # => 10
-10.numerator # => -10
//}

@
see Integer#denominator...

Integer#remainder(other) -> Numeric (26.0)

self を other で割った余り r を返します。

...

@
param other self を割る数。

//emlist[][ruby]{
5.remainder(3) # => 2
-5.remainder(3) # => -2
5.remainder(-3) # => 2
-5.remainder(-3) # => -2

-1234567890987654321.remainder(13731) # => -6966
-1234567890987654321.remainder(13731.24) # => -9906.22531493148
//}

@
see Integer#di...
...vmod, Integer#modulo, Numeric#modulo...

Integer#truncate(ndigits = 0) -> Integer (26.0)

0 から self までの整数で、自身にもっとも近い整数を返します。

...も近い整数を返します。

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

//emlist[][ruby]{
1.truncate # => 1
1.tr...
...uncate(2) # => 1
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}

@
see Numeric#truncate...

Integer#truncate(ndigits = 0) -> Integer | Float (26.0)

0 から self までの整数で、自身にもっとも近い整数を返します。

...

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

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

@
see Numeric#truncate...

Integer#&(other) -> Integer (20.0)

ビット二項演算子。論理積を計算します。

...ビット二項演算子。論理積を計算します。

@
param other 数値

//emlist[][ruby]{
1 & 1 # => 1
2 & 3 # => 2
//}...

絞り込み条件を変える

Integer#<<(bits) -> Integer (20.0)

シフト演算子。bits だけビットを左にシフトします。

...シフト演算子。bits だけビットを左にシフトします。

@
param bits シフトさせるビット数

//emlist[][ruby]{
printf("%#b\n", 0b0101 << 1) # => 0b1010
p -1 << 1 # => -2
//}...

Integer#>>(bits) -> Integer (20.0)

シフト演算子。bits だけビットを右にシフトします。

...、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。

@
param bits シフトさせるビット数

//emlist[][ruby]{
printf("%#b\n", 0b0101 >> 1) # => 0b10
p -1 >> 1 # => -1
//}...

Integer#^(other) -> Integer (20.0)

ビット二項演算子。排他的論理和を計算します。

...ビット二項演算子。排他的論理和を計算します。

@
param other 数値

//emlist[][ruby]{
1 ^ 1 # => 0
2 ^ 3 # => 1
//}...

Integer#bit_length -> Integer (20.0)

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

...のようなビットがない(0 や
-1 である)場合は 0 を返します。

//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...
...# => 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#ceildiv(other) -> Integer (20.0)

self を other で割り、その(剰余を考えない)商を整数に切り上げたものを返します。 すなわち、self を other で割った商を q とすると、q 以上で最小の整数を返します。

...
すなわち、self を other で割った商を q とすると、q 以上で最小の整数を返します。

@
param other self を割る数を指定します。

//emlist[][ruby]{
3.ceildiv(3) # => 1
4.ceildiv(3) # => 2
5.ceildiv(3) # => 2
3.ceildiv(1.2) # => 3
-5.ceildiv(3) # =>...

絞り込み条件を変える

Integer#next -> Integer (20.0)

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

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

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

@
see Integer#pred...
<< < ... 4 5 6 7 8 > >>