るりまサーチ

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

別のキーワード

  1. _builtin ceil
  2. bigdecimal ceil
  3. float ceil
  4. integer ceil
  5. numeric ceil

キーワード

検索結果

Integer#ceil(ndigits = 0) -> Integer (18135.0)

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

...数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。

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

@see Numeric#ceil...

Integer#ceil(ndigits = 0) -> Integer | Float (18135.0)

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

...負の整数を指定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。

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

@see Numeric#ceil...

Integer#ceildiv(other) -> Integer (6104.0)

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

...r で割った商を 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) # => -1
-5.ceildiv(-3) # => 2
//}...

Integer#bit_length -> Integer (10.0)

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

...2**n の場合は n+1 になります。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...
...# => 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...