るりまサーチ

最速Rubyリファレンスマニュアル検索!
134件ヒット [1-100件を表示] (0.025秒)

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric round
  4. numeric conj
  5. numeric quo

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Numeric#round -> Integer (39143.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 (38154.0)

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

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

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで...
...提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce...
...- - - o
remainder | o - - o - - -
round
| o o - - o o -
singleton_method_added | o - -...
...angular | o - - - o
remainder | o o - - -
round
| o o o o -
singleton_method_added | o - - - -...

Numeric#ceil -> Integer (21024.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#floor -> Integer (21024.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#floor(ndigits = 0) -> Integer (21024.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...

絞り込み条件を変える

Numeric#floor(ndigits = 0) -> Integer | Float (21024.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...

Numeric#truncate -> Integer (21024.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...

Integer#round(ndigits = 0, half: :up) -> Integer (18191.0)

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

...y]{
1.round # => 1
1.round(2) # => 1
15.round(-1) # => 20
(-15).round(-1) # => -20

25.round(-1, half: :up) # => 30
25.round(-1, half: :down) # => 20
25.round(-1, half: :even) # => 20
35.round(-1, half: :up) # => 40
35.round(-1, half: :down) # => 30
35.round(-1, h...
...alf: :even) # => 40
(-25).round(-1, half: :up) # => -30
(-25).round(-1, half: :down) # => -20
(-25).round(-1, half: :even) # => -20
//}

@see Numeric#round...

Integer#round(ndigits = 0, half: :up) -> Integer | Float (18191.0)

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

...]{
1.round # => 1
1.round(2) # => 1.0
15.round(-1) # => 20
(-15).round(-1) # => -20

25.round(-1, half: :up) # => 30
25.round(-1, half: :down) # => 20
25.round(-1, half: :even) # => 20
35.round(-1, half: :up) # => 40
35.round(-1, half: :down) # => 30
35.round(-1,...
...half: :even) # => 40
(-25).round(-1, half: :up) # => -30
(-25).round(-1, half: :down) # => -20
(-25).round(-1, half: :even) # => -20
//}

@see Numeric#round...

NEWS for Ruby 2.4.0 (48.0)

NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...追加 9969

* Float
* Float#ceil, Float#floor, Float#truncate は
Float#roundと同じように省略可能な桁を指定する引数を受け付けるようになりました。12245
* Float#round は half というキーワード引数を受け付けるようになりました。...
...ncate は
Integer#round と同じように省略可能な桁を指定する引数を受け付けるようになりました 12245
* Integer#digits を追加。 12447
位置記法のために各桁を展開するためのメソッドです。
* Integer#round は half というキ...
...es を追加 7418

* Numeric
* Numeric#finite?, Numeric#infinite? を追加 12039

* Process
* macOS 10.12 から導入された CLOCK_MONOTONIC_RAW_APPROX, CLOCK_UPTIME_RAW,
CLOCK_UPTIME_RAW_APPROX をサポートしました

* Rational
* Rational#round は half という...

絞り込み条件を変える

Float#to_i -> Integer (24.0)

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

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


//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
//}

@see Numeric#round, Numeric#ceil, Numeric#floor...
...す。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
1.234567.truncate(2) # => 1.23
34567.89.truncate(-2) # => 34500
//}

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

Float#truncate -> Integer (24.0)

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

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


//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
//}

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

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

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

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

//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
1.234567.truncate(2) # => 1.23
34567.89.truncate(-2) # => 34500
//}

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

NEWS for Ruby 2.3.0 (24.0)

NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...追加
11398

* NameError
* レシーバーオブジェクトを返す NameError#receiver を追加
10881

* Numeric
* Numeric#positive?, Numeric#negative? を追加
11151

* Proc
* Proc#call ( Proc#[] , Proc#===, Proc#yield) は最適化されました。
B...
...10740

* drb
* 使用していない引数を削除しました。
https://github.com/ruby/ruby/pull/515

* matrix
* Vector#roundを追加。
https://github.com/ruby/ruby/pull/802

* webrick/utils
* 使用していない引数を削除しました。
https:/...
<< 1 2 > >>