125件ヒット
[1-100件を表示]
(0.039秒)
種類
- インスタンスメソッド (81)
- 特異メソッド (36)
- 文書 (8)
ライブラリ
- ビルトイン (57)
- bigdecimal (36)
- matrix (24)
クラス
- BigDecimal (36)
- Float (21)
- Matrix (24)
- Rational (36)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (8) - ceil (12)
- eigen (12)
- eigensystem (12)
- floor (12)
- limit (12)
- mode (24)
検索結果
先頭5件
-
Float
# round(ndigits = 0) -> Integer | Float (18216.0) -
自身ともっとも近い整数もしくは実数を返します。
...。
@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)......# => 3.142
t.round(0) # => 3
t.round(1) # => 3.1
t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0
2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down......) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}
@see Float#ceil, Float#floor, Float#truncate... -
Float
# round(ndigits = 0 , half: :up) -> Integer | Float (18216.0) -
自身ともっとも近い整数もしくは実数を返します。
...。
@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)......# => 3.142
t.round(0) # => 3
t.round(1) # => 3.1
t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0
2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down......) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}
@see Float#ceil, Float#floor, Float#truncate... -
Float
# round(ndigits = 0) -> Integer | Float (18179.0) -
自身ともっとも近い整数もしくは実数を返します。
...。
@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)......# => 3.142
t.round(0) # => 3
t.round(1) # => 3.1
t = t**10 # => 93648.04747608298
t.round(-0) # => 93648
t.round(-1) # => 93650
t.round(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0
//}
@see Float#ceil, Float#floor, Float#truncate... -
Rational
# round(precision = 0) -> Integer | Rational (18155.0) -
自身ともっとも近い整数を返します。
...れます。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).round # => 3
Rational(2, 3).round # => 1
Rational(-3, 2).round # => -2
//}
precision を指定した場合は指定し......ます。
//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... -
BigDecimal
. mode(s) -> Integer | nil (96.0) -
BigDecimal の計算処理の制御方法を設定、確認します。
...を行う項目を BigDecimal::EXCEPTION_*、
BigDecimal::ROUND_MODE のいずれかで指定します。
@param v 引数 s が BigDecimal::ROUND_MODE の場合は
BigDecimal::ROUND_MODE 以外の BigDecimal::_ROUND* のいず
れかを指定します。指定した丸め......が有効になり、false を指定した場合
は設定値が無効になります。
@raise TypeError 引数 s に有効でない値を指定した場合に発生します。
@raise ArgumentError 引数 s に例外処理に関する値を指定し、引数 v に
t......l'
flag = BigDecimal::ROUND_HALF_UP # デフォルト値
f = BigDecimal::mode(BigDecimal::ROUND_MODE,flag)
//}
の形式で指定します。
ここで、flag は以下(括弧内は対応するインスタンスメソッド)の一つを指定します。
* BigDecimal::ROUND_UP 全て切り上げ... -
BigDecimal
. mode(s , v) -> Integer | nil (96.0) -
BigDecimal の計算処理の制御方法を設定、確認します。
...を行う項目を BigDecimal::EXCEPTION_*、
BigDecimal::ROUND_MODE のいずれかで指定します。
@param v 引数 s が BigDecimal::ROUND_MODE の場合は
BigDecimal::ROUND_MODE 以外の BigDecimal::_ROUND* のいず
れかを指定します。指定した丸め......が有効になり、false を指定した場合
は設定値が無効になります。
@raise TypeError 引数 s に有効でない値を指定した場合に発生します。
@raise ArgumentError 引数 s に例外処理に関する値を指定し、引数 v に
t......l'
flag = BigDecimal::ROUND_HALF_UP # デフォルト値
f = BigDecimal::mode(BigDecimal::ROUND_MODE,flag)
//}
の形式で指定します。
ここで、flag は以下(括弧内は対応するインスタンスメソッド)の一つを指定します。
* BigDecimal::ROUND_UP 全て切り上げ... -
BigDecimal
. limit(n = nil) -> Integer (12.0) -
生成されるBigDecimalオブジェクトの最大桁数をn桁に制限します。 n を指定しない、または n が nil の場合は、現状の最大桁数が返ります。
...BigDecimal.mode で指定された丸め処理が
実行されます。ただし、インスタンスメソッド (BigDecimal#truncate /
BigDecimal#round / BigDecimal#ceil / BigDecimal#floor /
BigDecimal#add/ BigDecimal#sub / BigDecimal#mult /
BigDecimal#div) の桁数制限は limit より優先さ......れます。
//emlist[][ruby]{
require 'bigdecimal'
n = 0 # デフォルト値
mf = BigDecimal::limit(n)
//}
@param n 新しい最大桁数を正の整数で指定します。
@raise ArgumentError n に負の数を指定した場合に発生します。... -
Matrix
# eigen -> Matrix :: EigenvalueDecomposition (12.0) -
行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。
...quire '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::EigenvalueDecompositio... -
Matrix
# eigensystem -> Matrix :: EigenvalueDecomposition (12.0) -
行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。
...quire '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::EigenvalueDecompositio... -
NEWS for Ruby 2
. 5 . 0 (12.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...に改良しました。
このメッセージはユーザーにとってわかりやすいでしょう。 13405
* Integer
* Integer#round, Integer#floor, Integer#ceil, Integer#truncate は常に Integer を返すようになりました
13420
* Integer#pow を追加 12508 110......_status を追加。$? と同じです 14043
* Range
* Range.new no longer hides exceptions when comparing begin and
end with #<=> and raise a "bad value for range" ArgumentError
but instead lets the exception from the #<=> call go through.
7688
* Regexp
* Onigmo 6.1...
