るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
9件ヒット [1-9件を表示] (0.063秒)
トップページ > バージョン:2.3.0[x] > クエリ:Integer[x] > クエリ:int[x] > クラス:Numeric[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

Numeric#integer? -> bool (36691.0)

自身が Integer かそのサブクラスのインスタンスの場合にtrue を返し ます。そうでない場合に false を返します。

...スタンスの場合にtrue を返し
ます。そうでない場合に false を返します。

Numeric
のサブクラスは、このメソッドを適切に再定義しなければなりません。

//emlist[例][ruby]{
(1.0).integer? #=> false
(1).integer? #=> true
//}

@see Numeric#real?...

Numeric#to_int -> Integer (18946.0)

self.to_i と同じです。

self.to_i と同じです。

//emlist[例][ruby]{
(2+0i).to_int # => 2
Rational(3).to_int # => 3
//}

Numeric#denominator -> Integer (625.0)

自身を Rational に変換した時の分母を返します。

...自身を Rational に変換した時の分母を返します。

@return 分母を返します。


@see Numeric#numerator、Integer#denominator、Float#denominator、Rational#denominator、Complex#denominator...

Numeric#numerator -> Integer (625.0)

自身を Rational に変換した時の分子を返します。

...自身を Rational に変換した時の分子を返します。

@return 分子を返します。


@see Numeric#denominator、Integer#numerator、Float#numerator、Rational#numerator、Complex#numerator...

Numeric#ceil -> Integer (607.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#div(other) -> Integer (607.0)

self を other で割った整数の商 q を返します。

...> 0 のとき: 0 <= r < other
* other < 0 のとき: other < r <= 0
* q は整数
をみたす数です。
商に対応する余りは Numeric#modulo で求められます。
div はメソッド / を呼びだし、floorを取ることで計算されます。

メソッド / の定義は...

Numeric#floor -> Integer (607.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...

Numeric#round -> Integer (607.0)

自身ともっとも近い整数を返します。

...0.5, -0.5 はそれぞれ 1,-1 に切り上げされます。いわゆる四捨五入ですが、偶数丸めではありません。

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

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

Numeric#truncate -> Integer (607.0)

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

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

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

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