221件ヒット
[1-100件を表示]
(0.117秒)
種類
- インスタンスメソッド (155)
- 特異メソッド (33)
- 定数 (11)
- ライブラリ (11)
- クラス (11)
ライブラリ
- ビルトイン (166)
- bigdecimal (44)
クラス
- BigDecimal (44)
- Float (63)
- Numeric (44)
- Rational (33)
- Time (15)
キーワード
- Numeric (11)
-
ROUND
_ CEILING (11) - bigdecimal (11)
- floor (38)
- limit (11)
- mode (22)
-
to
_ i (11) - truncate (22)
検索結果
先頭5件
-
Float
# ceil(ndigits = 0) -> Integer | Float (24309.0) -
自身と等しいかより大きな整数のうち最小のものを返します。
...。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返......ist[例][ruby]{
1.2.ceil # => 2
2.0.ceil # => 2
(-1.2).ceil # => -1
(-2.0).ceil # => -2
1.234567.ceil(2) # => 1.24
1.234567.ceil(3) # => 1.235
1.234567.ceil(4) # => 1.2346
1.234567.ceil(5) # => 1.23457
34567.89.ceil(-5) # => 100000
34567.89.ceil(-4) # => 40000
34567.89.ceil......(-3) # => 35000
34567.89.ceil(-2) # => 34600
34567.89.ceil(-1) # => 34570
34567.89.ceil(0) # => 34568
34567.89.ceil(1) # => 34567.9
34567.89.ceil(2) # => 34567.89
34567.89.ceil(3) # => 34567.89
//}
@see Float#floor, Float#round, Float#truncate... -
Time
# ceil(ndigits=0) -> Time (24273.0) -
十進小数点数で指定した桁数の精度で切り上げをし、 その Time オブジェクトを返します。 (デフォルトは0、つまり小数点の所で切り上げます)。
...Time オブジェクトを返します。
(デフォルトは0、つまり小数点の所で切り上げます)。
ndigits には 0 以上の整数を渡します。
@param ndigits 十進での精度(桁数)
//emlist[][ruby]{
require 'time'
t = Time.utc(2010,3,30, 5,43,25.0123456789r)
t.iso8601......:43:25.0123456789Z"
t.ceil.iso8601(10) # => "2010-03-30T05:43:26.0000000000Z"
t.ceil(0).iso8601(10) # => "2010-03-30T05:43:26.0000000000Z"
t.ceil(1).iso8601(10) # => "2010-03-30T05:43:25.1000000000Z"
t.ceil(2).iso8601(10) # => "2010-03-30T05:43:25.0200000000Z"
t.ceil(3).iso8601(10) # => "201......# => "2000-01-01T00:00:00.000Z"
(t + 1.4).ceil.iso8601(3) # => "2000-01-01T00:00:01.000Z"
(t + 1.9).ceil.iso8601(3) # => "2000-01-01T00:00:01.000Z"
t = Time.utc(1999,12,31, 23,59,59)
(t + 0.123456789).ceil(4).iso8601(6) # => "1999-12-31T23:59:59.123500Z"
//}
@see Time#floor, Time#round... -
Rational
# ceil(precision = 0) -> Integer | Rational (24249.0) -
自身と等しいかより大きな整数のうち最小のものを返します。
...を返します。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).ceil # => 3
Rational(2, 3).ceil # => 1
Rational(-3, 2).ceil # => -1
//}
precision を指定した場合は指......か Rational を返します。
//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#trunc... -
Float
# ceil -> Integer (24231.0) -
自身と等しいかより大きな整数のうち最小のものを返します。
...自身と等しいかより大きな整数のうち最小のものを返します。
//emlist[例][ruby]{
1.2.ceil # => 2
2.0.ceil # => 2
(-1.2).ceil # => -1
(-2.0).ceil # => -2
//}
@see Float#floor, Float#round, Float#truncate... -
Numeric
# ceil -> Integer (24231.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... -
Rational
# round(precision = 0) -> Integer | Rational (21255.0) -
自身ともっとも近い整数を返します。
...げされます。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).round # => 3
Rational(2, 3).round # => 1
Rational(-3, 2).round # => -2
//}
precision を指定した場合は指......ational を返します。
//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 Ratio......nal#ceil, Rational#floor, Rational#truncate... -
Time
# round(ndigits=0) -> Time (21249.0) -
十進小数点数で指定した桁数の精度で丸めをし、 その Time オブジェクトを返します。 (デフォルトは0、つまり小数点の所で丸めます)。
...Time オブジェクトを返します。
(デフォルトは0、つまり小数点の所で丸めます)。
ndigits には 0 以上の整数を渡します。
@param ndigits 十進での精度(桁数)
//emlist[][ruby]{
require 'time'
t = Time.utc(1999,12,31, 23,59,59)
p((t + 0.4).round.iso8601......0Z"
p((t + 0.49).round.iso8601(3)) # => "1999-12-31T23:59:59.000Z"
p((t + 0.5).round.iso8601(3)) # => "2000-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) # => "1999-12-31T23:59:59.123500Z"
//}
@see Time#ceil, Time#floor... -
Numeric
# round -> Integer (21231.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... -
Float
# round(ndigits = 0) -> Integer | Float (18316.0) -
自身ともっとも近い整数もしくは実数を返します。
...ません。
@param ndigits 丸める位を指定します。
ndigitsが0ならば、小数点以下を四捨五入し、整数を返します。
ndigitsが0より大きいならば、小数点以下の指定された位で四捨五入されます。
ndigitsが0より小さい......ndigitsが0より大きいならば、実数を返します。
ndigitsが0より小さいならば、整数を返します。
@raise TypeError ndigits で指定されたオブジェクトが整数に変換できない場
合発生します。
//emlist[例][ruby]{
1.0.round.......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
# round(ndigits = 0 , half: :up) -> Integer | Float (18316.0) -
自身ともっとも近い整数もしくは実数を返します。
...ません。
@param ndigits 丸める位を指定します。
ndigitsが0ならば、小数点以下を四捨五入し、整数を返します。
ndigitsが0より大きいならば、小数点以下の指定された位で四捨五入されます。
ndigitsが0より小さい......ndigitsが0より大きいならば、実数を返します。
ndigitsが0より小さいならば、整数を返します。
@raise TypeError ndigits で指定されたオブジェクトが整数に変換できない場
合発生します。
//emlist[例][ruby]{
1.0.round.......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... -
BigDecimal
:: ROUND _ CEILING -> Integer (18301.0) -
BigDecimal の計算結果の丸め処理で数値の大きい方に繰り上げるかどう かを設定、確認する際の値を返します。
...BigDecimal の計算結果の丸め処理で数値の大きい方に繰り上げるかどう
かを設定、確認する際の値を返します。
BigDecimal.mode の第 2 引数に指定します。... -
Float
# round(ndigits = 0) -> Integer | Float (18279.0) -
自身ともっとも近い整数もしくは実数を返します。
...ません。
@param ndigits 丸める位を指定します。
ndigitsが0ならば、小数点以下を四捨五入し、整数を返します。
ndigitsが0より大きいならば、小数点以下の指定された位で四捨五入されます。
ndigitsが0より小さい......ndigitsが0より大きいならば、実数を返します。
ndigitsが0より小さいならば、整数を返します。
@raise TypeError ndigits で指定されたオブジェクトが整数に変換できない場
合発生します。
//emlist[例][ruby]{
1.0.round......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#floo... -
Float
# to _ i -> Integer (6113.0) -
小数点以下を切り捨てて値を整数に変換します。
...小数点以下を切り捨てて値を整数に変換します。
//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
//}
@see Numeric#round, Numeric#ceil, Numeric#floor......。
@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返......す。
小数点位置から左に少なくとも 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...