114件ヒット
[1-100件を表示]
(0.088秒)
種類
- インスタンスメソッド (74)
- 特異メソッド (33)
- 文書 (7)
ライブラリ
- ビルトイン (52)
- bigdecimal (33)
- matrix (22)
クラス
- BigDecimal (33)
- Float (19)
- Matrix (22)
- Rational (33)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (7) - ceil (11)
- eigen (11)
- eigensystem (11)
- floor (11)
- limit (11)
- mode (22)
検索結果
先頭5件
-
Float
# round(ndigits = 0) -> Integer | Float (18334.0) -
自身ともっとも近い整数もしくは実数を返します。
...自身ともっとも近い整数もしくは実数を返します。
中央値 0.5, -0.5 はそれぞれ 1,-1 に切り上げされます。
いわゆる四捨五入ですが、偶数丸めではありません。
@param ndigits 丸める位を指定します。
ndigitsが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... -
Float
# round(ndigits = 0 , half: :up) -> Integer | Float (18334.0) -
自身ともっとも近い整数もしくは実数を返します。
...自身ともっとも近い整数もしくは実数を返します。
中央値 0.5, -0.5 はそれぞれ 1,-1 に切り上げされます。
いわゆる四捨五入ですが、偶数丸めではありません。
@param ndigits 丸める位を指定します。
ndigitsが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... -
Float
# round(ndigits = 0) -> Integer | Float (18297.0) -
自身ともっとも近い整数もしくは実数を返します。
...自身ともっとも近い整数もしくは実数を返します。
中央値 0.5, -0.5 はそれぞれ 1,-1 に切り上げされます。
いわゆる四捨五入ですが、偶数丸めではありません。
@param ndigits 丸める位を指定します。
ndigitsが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 (18291.0) -
自身ともっとも近い整数を返します。
....5, -0.5 はそれぞれ 1,-1 に切り上げされます。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).round # => 3
Rational(2, 3).round # => 1
Rational(-3, 2).round # => -2......す。
//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, Rational#f... -
BigDecimal
. mode(s) -> Integer | nil (214.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......cimal::EXCEPTION_INFINITY のとき、無限(+ or -Infinity)
* BigDecimal::EXCEPTION_UNDERFLOW のとき、ゼロ
* BigDecimal::EXCEPTION_OVERFLOW のとき、+Infinity か -Infinity
* BigDecimal::EXCEPTION_ZERODIVIDE のとき、+Infinity か -Infinity
BigDecimal::EXCEPTION_INFINITY、BigDec... -
BigDecimal
. mode(s , v) -> Integer | nil (214.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......cimal::EXCEPTION_INFINITY のとき、無限(+ or -Infinity)
* BigDecimal::EXCEPTION_UNDERFLOW のとき、ゼロ
* BigDecimal::EXCEPTION_OVERFLOW のとき、+Infinity か -Infinity
* BigDecimal::EXCEPTION_ZERODIVIDE のとき、+Infinity か -Infinity
BigDecimal::EXCEPTION_INFINITY、BigDec... -
Rational
# floor(precision = 0) -> Integer | Rational (148.0) -
自身と等しいかより小さな整数のうち最大のものを返します。
...ます。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).floor # => 3
Rational(2, 3).floor # => 0
Rational(-3, 2).floor # => -2
//}
Rational#to_i とは違う結果を返す事......1
Rational(-7, 4).to_i # => -1
Rational(-7, 4).floor # => -2
//}
precision を指定した場合は指定した桁数の数値と、上述の性質に最も近い整
数か Rational を返します。
//emlist[例][ruby]{
Rational('-123.456').floor(+1) # => (-247/2)
Rational('-123.456').fl......oor(+1).to_f # => -123.5
Rational('-123.456').floor(0) # => -124
Rational('-123.456').floor(-1) # => -130
//}
@see Rational#ceil, Rational#round, Rational#truncate... -
Rational
# ceil(precision = 0) -> Integer | Rational (136.0) -
自身と等しいかより大きな整数のうち最小のものを返します。
...ます。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).ceil # => 3
Rational(2, 3).ceil # => 1
Rational(-3, 2).ceil # => -1
//}
precision を指定した場合は指定した......ational を返します。
//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... -
NEWS for Ruby 2
. 5 . 0 (126.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...は参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.4.0 以降の変更
=== 言語仕様の変更
* トップレベルの定数参照を削除......に改良しました。
このメッセージはユーザーにとってわかりやすいでしょう。 13405
* Integer
* Integer#round, Integer#floor, Integer#ceil, Integer#truncate は常に Integer を返すようになりました
13420
* Integer#pow を追加 12508 110......and raise a "bad value for range" ArgumentError
but instead lets the exception from the #<=> call go through.
7688
* Regexp
* Onigmo 6.1.3-669ac9997619954c298da971fcfacccf36909d05 に更新
* 非包含オペレータ(absence operator)をサポート https://github.com/k-tak... -
BigDecimal
. limit(n = nil) -> Integer (112.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 (112.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...