るりまサーチ

最速Rubyリファレンスマニュアル検索!
182件ヒット [1-100件を表示] (0.057秒)
トップページ > クエリ:p[x] > クエリ:round[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. rsa p
  5. kernel p

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

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

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

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

@param ndigits 丸める位を指定します。
ndigitsが0ならば、小数点以下を四捨五入し、整数を返します。
ndigi...
...ならば、小数点以上の指定された位で四捨五入されます。
@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。

* :up or nil: 0から遠い方に丸められます。
* :even: もっとも近い...
...@raise TypeError ndigits で指定されたオブジェクトが整数に変換できない場
合発生します。

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

t = Math::PI # => 3.141592653589793
t.round(3) # =...

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

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

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

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
@param half ちょうど半分の値の丸め...
...:up or nil: 0から遠い方に丸められます。
* :even: もっとも近い偶数に丸められます。
* :down: 0に近い方に丸められます。

//emlist[][ruby]{
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, half: :even) # => 40
(-25).round(-1, half: :up) # => -30
(-25).round(-1, half: :down) # => -20
(-25).round(-1, half: :eve...

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

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

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

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。...
...小数点位置から左に少なくとも n 個の 0 が並びます。
@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。

* :up or nil: 0から遠い方に丸められます。
* :even: もっとも近い...
...]{
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,...

Rational#round(precision = 0) -> Integer | Rational (18249.0)

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

...り上げされます。

@param precision 計算結果の精度

@raise TypeError precision に整数以外のものを指定すると発生します。

//emlist[例][ruby]{
Rational(3).round # => 3
Rational(2, 3).round # => 1
Rational(-3, 2).round # => -2
//}

p
recision を指定した場合...
...ます。

//emlist[例][ruby]{
Rational('-123.456').round(+1) # => (-247/2)
Rational('-123.456').round(+1).to_f # => -123.5
Rational('-123.456').round(0) # => -123
Rational('-123.456').round(-1) # => -120
Rational('-123.456').round(-2) # => -100
//}

@see Rational#ceil, Rationa...

Time#round(ndigits=0) -> Time (18185.0)

十進小数点数で指定した桁数の精度で丸めをし、 その Time オブジェクトを返します。 (デフォルトは0、つまり小数点の所で丸めます)。

...を渡します。

@param ndigits 十進での精度(桁数)

//emlist[][ruby]{
require 'time'

t = Time.utc(1999,12,31, 23,59,59)
p
((t + 0.4).round.iso8601(3)) # => "1999-12-31T23:59:59.000Z"
p
((t + 0.49).round.iso8601(3)) # => "1999-12-31T23:59:59.000Z"
p
((t + 0.5).round.iso8601(3)) # =>...
...0-01-01T00:00:00.000Z"
p
((t + 1.4).round.iso8601(3)) # => "2000-01-01T00:00:00.000Z"
p
((t + 1.49).round.iso8601(3)) # => "2000-01-01T00:00:00.000Z"
p
((t + 1.5).round.iso8601(3)) # => "2000-01-01T00:00:01.000Z"

t = Time.utc(1999,12,31, 23,59,59)
p
(t + 0.123456789).round(4).iso8601(6) # =>...

絞り込み条件を変える

BigDecimal::ROUND_HALF_UP -> Integer (12201.0)

BigDecimal の計算結果の丸め処理で四捨五入するかどうかを設定、確認 する際の値を返します。

BigDecimal の計算結果の丸め処理で四捨五入するかどうかを設定、確認
する際の値を返します。

BigDecimal.mode の第 2 引数に指定します。

BigDecimal::ROUND_UP -> Integer (12201.0)

BigDecimal の計算結果の丸め処理で全て切り上げするかどうかを設定、 確認する際の値を返します。

BigDecimal の計算結果の丸め処理で全て切り上げするかどうかを設定、
確認する際の値を返します。

BigDecimal.mode の第 2 引数に指定します。

Socket::Constants::SOPRI_BACKGROUND -> Integer (12200.0)

@todo Background socket priority

...@todo
Background socket priority...

Socket::SOPRI_BACKGROUND -> Integer (12200.0)

@todo Background socket priority

...@todo
Background socket priority...

Matrix#eigen -> Matrix::EigenvalueDecomposition (106.0)

行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。

...行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。

Matrix::EigenvalueDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(右固有ベクトル、固有値行列、左固有ベクトル)
を得ることがで...
...re 'matrix'
m = Matrix[[1, 2], [3, 4]]
v, d, v_inv = m.eigensystem
d.diagonal? # => true
v.inv == v_inv # => true
(v * d * v_inv).round(5) == m # => true
//}

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方行列でない場合に発生します
@see Matrix::EigenvalueDecomposition...

絞り込み条件を変える

<< 1 2 > >>