るりまサーチ

最速Rubyリファレンスマニュアル検索!
186件ヒット [1-100件を表示] (0.038秒)

別のキーワード

  1. net/imap param
  2. win32ole win32ole_param
  3. win32ole_param to_s
  4. win32ole_param input?
  5. win32ole_param new

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Float#round(ndigits = 0) -> Integer | Float (18223.0)

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

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

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

* :up or nil: 0...
...]{
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)...

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

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

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

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

* :up or nil: 0...
...]{
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)...

BigDecimal#round -> Integer (18202.0)

クラスメソッド BigDecimal.mode(BigDecimal::ROUND_MODE,flag) で指定した BigDecimal::ROUND_MODE に従って丸め操作を実行します。

...クラスメソッド BigDecimal.mode(BigDecimal::ROUND_MODE,flag) で指定した
BigDecimal::ROUND_MODE に従って丸め操作を実行します。

@param n 小数点以下の桁数を整数で指定します。

@param b 丸め処理の方式として、BigDecimal.mode の第 1 引数と同...
...ecimal::ROUND_MODE,flag) で何も指定せず、
かつ、引数を指定しない場合は
「小数点以下第一位の数を四捨五入して整数(BigDecimal 値)」にします。

//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").round # => 1
BigDecimal("-1.23456").round # =>...
...456").round(4).to_f # => 1.2346
BigDecimal("15.23456").round(-1).to_f # => 20.0
//}

2番目の引数を指定すると、BigDecimal.mode の指定を無視して、指定さ
れた方法で丸め操作を実行します。

//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").round(3,Bi...

BigDecimal#round(n) -> BigDecimal (18202.0)

クラスメソッド BigDecimal.mode(BigDecimal::ROUND_MODE,flag) で指定した BigDecimal::ROUND_MODE に従って丸め操作を実行します。

...クラスメソッド BigDecimal.mode(BigDecimal::ROUND_MODE,flag) で指定した
BigDecimal::ROUND_MODE に従って丸め操作を実行します。

@param n 小数点以下の桁数を整数で指定します。

@param b 丸め処理の方式として、BigDecimal.mode の第 1 引数と同...
...ecimal::ROUND_MODE,flag) で何も指定せず、
かつ、引数を指定しない場合は
「小数点以下第一位の数を四捨五入して整数(BigDecimal 値)」にします。

//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").round # => 1
BigDecimal("-1.23456").round # =>...
...456").round(4).to_f # => 1.2346
BigDecimal("15.23456").round(-1).to_f # => 20.0
//}

2番目の引数を指定すると、BigDecimal.mode の指定を無視して、指定さ
れた方法で丸め操作を実行します。

//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").round(3,Bi...

BigDecimal#round(n, b) -> BigDecimal (18202.0)

クラスメソッド BigDecimal.mode(BigDecimal::ROUND_MODE,flag) で指定した BigDecimal::ROUND_MODE に従って丸め操作を実行します。

...クラスメソッド BigDecimal.mode(BigDecimal::ROUND_MODE,flag) で指定した
BigDecimal::ROUND_MODE に従って丸め操作を実行します。

@param n 小数点以下の桁数を整数で指定します。

@param b 丸め処理の方式として、BigDecimal.mode の第 1 引数と同...
...ecimal::ROUND_MODE,flag) で何も指定せず、
かつ、引数を指定しない場合は
「小数点以下第一位の数を四捨五入して整数(BigDecimal 値)」にします。

//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").round # => 1
BigDecimal("-1.23456").round # =>...
...456").round(4).to_f # => 1.2346
BigDecimal("15.23456").round(-1).to_f # => 20.0
//}

2番目の引数を指定すると、BigDecimal.mode の指定を無視して、指定さ
れた方法で丸め操作を実行します。

//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1.23456").round(3,Bi...

絞り込み条件を変える

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

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

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

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
@param half ちょうど半分の値の丸め方...
...y]{
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, h...
...alf: :even) # => 40
(-25).round(-1, half: :up) # => -30
(-25).round(-1, half: :down) # => -20
(-25).round(-1, half: :even) # => -20
//}

@see Numeric#round...

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

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

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

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

* :up or nil: 0か...
...]{
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,...

Float#round(ndigits = 0) -> Integer | Float (18180.0)

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

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

@param ndigits 丸める位を指定します。
ndigitsが0ならば、小数点以下を四捨五入し、整数を返します。
ndigit...
...]{
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 (18156.0)

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

...-1 に切り上げされます。

@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...

Time#round(ndigits=0) -> Time (18150.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)) # =>...
...T00: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-1...

絞り込み条件を変える

IRB::ExtendCommand::Foreground#execute(*obj) -> IRB::Irb (3007.0)

指定したサブ irb に移動します。

...指定したサブ irb に移動します。

@param obj 移動するサブ irb を識別する以下のいずれかのオブジェクトを指定します。

* irb インタプリタ番号
* irb オブジェクト
* スレッド ID
* 各インタプリタの self (「irb(obj)」で起動し...
<< 1 2 > >>