るりまサーチ

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer new
  5. integer chr

クラス

キーワード

検索結果

<< 1 2 3 > >>

Integer#ceil(ndigits = 0) -> Integer | Float (39240.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#ceil(ndigits = 0) -> Integer (39234.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#ceildiv(other) -> Integer (27203.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 (21115.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...

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

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

...Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[例][ruby]{
1.2.ceil # => 2
2.0.ceil # => 2
(-1.2).ceil # => -1
(-2.0).ceil # => -2

1.234567.ceil(2) # => 1.24
1.234567.ceil(3) # => 1.235
1.234567.ceil(4)...
...1.234567.ceil(5) # => 1.23457

34567.89.ceil(-5) # => 100000
34567.89.ceil(-4) # => 40000
34567.89.ceil(-3) # => 35000
34567.89.ceil(-2) # => 34600
34567.89.ceil(-1) # => 34570
34567.89.ceil(0) # => 34568
34567.89.ceil(1) # => 34567.9
34567.89.ceil(2) # => 34567.89
34567.89.ceil(3) #...

絞り込み条件を変える

Rational#ceil(precision = 0) -> Integer | Rational (18246.0)

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

...uby]{
Rational(3).ceil # => 3
Rational(2, 3).ceil # => 1
Rational(-3, 2).ceil # => -1
//}

precision を指定した場合は指定した桁数の数値と、上述の性質に最も近い整
数か Rational を返します。

//emlist[例][ruby]{
Rational('-123.456').ceil(+1) # => (-...
...617/5)
Rational('-123.456').ceil(+1).to_f # => -123.4
Rational('-123.456').ceil(0) # => -123
Rational('-123.456').ceil(-1) # => -120
//}

@see Rational#floor, Rational#round, Rational#truncate...

Float#ceil -> Integer (18228.0)

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

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


//emlist[例][ruby]{
1.2.ceil # => 2
2.0.ceil # => 2
(-1.2).ceil # => -1
(-2.0).ceil # => -2
//}

@see Float#floor, Float#round, Float#truncate...

Numeric#ceil -> Integer (18228.0)

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

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

//emlist[例][ruby]{
1.ceil #=> 1
1.2.ceil #=> 2
(-1.2).ceil #=> -1
(-1.5).ceil #=> -1
//}

@see Numeric#floor, Numeric#round, Numeric#truncate...

Numeric (126.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...数値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッ...
...れのクラスを参照してください。


=> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational Complex
------------------------------------------------------------------------------...
...o o
< | - - o o o - -
Numeric Integer Fixnum Bignum Float Rational Complex
-----------------------------------------------------------------------------...
...クラスを参照してください。


=> ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
% |...
...o o o
< | - o o - -
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
<< |...

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

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

...Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[例][ruby]{
1.floor #=> 1
1.2.floor #=> 1
(-1.2).floor #=> -2
(-1.5).floor #=> -2
//}

@see Numeric#ceil, Numeric#round, Numeric#truncate
@see Integer#floor...

絞り込み条件を変える

Float#to_i -> Integer (116.0)

小数点以下を切り捨てて値を整数に変換します。

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

//emlist[例][ruby]{
2.8.truncate...

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

小数点以下を切り捨てて値を整数に変換します。

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

//emlist[例][ruby]{
2.8.truncate...

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

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

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

//emlist[例][ruby]{
1.2.floor #...
...oor(-4) # => 30000
34567.89.floor(-3) # => 34000
34567.89.floor(-2) # => 34500
34567.89.floor(-1) # => 34560
34567.89.floor(0) # => 34567
34567.89.floor(1) # => 34567.8
34567.89.floor(2) # => 34567.89
34567.89.floor(3) # => 34567.89
//}

@see Numeric#ceil, Numeric#round, Float#truncate...

Numeric#floor(ndigits = 0) -> Integer (115.0)

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

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

//emlist[例][ruby]{
1.floor #=> 1
1.2.floor #=> 1
(-1.2).floor #=> -2
(-1.5).floor #=> -2
//}

@see Numeric#ceil, Numeric#round, Numeric#truncate
@see Integer#floor...
<< 1 2 3 > >>