232件ヒット
[201-232件を表示]
(0.010秒)
種類
- インスタンスメソッド (162)
- 特異メソッド (33)
- 文書 (15)
- ライブラリ (11)
- クラス (11)
ライブラリ
- ビルトイン (173)
- bigdecimal (33)
クラス
- BigDecimal (33)
- Float (63)
- Numeric (44)
- Rational (55)
キーワード
-
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) - Numeric (11)
- bigdecimal (11)
- floor (33)
- limit (11)
- mode (22)
- round (41)
-
to
_ i (22)
検索結果
先頭3件
-
Rational
# floor(precision = 0) -> Integer | Rational (12.0) -
自身と等しいかより小さな整数のうち最大のものを返します。
...onal を返します。
//emlist[例][ruby]{
Rational('-123.456').floor(+1) # => (-247/2)
Rational('-123.456').floor(+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
# round(precision = 0) -> Integer | Rational (12.0) -
自身ともっとも近い整数を返します。
...y]{
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#floor, Rational#truncate... -
bigdecimal (12.0)
-
bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。
...定できます。
//emlist[][ruby]{
require "bigdecimal"
p BigDecimal("2").div(3, 12).to_s(10) # 2.0 / 3.0
# => 0.6666666666 67e0
//}
: truncate, round, ceil, floor
これらのメソッドは小数点からの相対位置を指定して桁数を決定します。
//emlist[][ruby]{
require "b...