るりまサーチ

最速Rubyリファレンスマニュアル検索!
216件ヒット [101-200件を表示] (0.107秒)

別のキーワード

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

ライブラリ

キーワード

検索結果

<< < 1 2 3 > >>

Rational#-(other) -> Rational | Float (14.0)

差を計算します。

...差を計算します。

@param other 自身から引く数

other に Float を指定した場合は、計算結果を Float で返しま
す。

//emlist[例][ruby]{
r = Rational(3, 4)
r - 1 # => (-1/4)
r - 0.5 # => 0.25
//}...

Rational#/(other) -> Rational | Float (14.0)

商を計算します。

...算します。

@param other 自身を割る数

other に Float を指定した場合は、計算結果を Float で返します。

//emlist[例][ruby]{
r = Rational(3, 4)
r / 2 # => (3/8)
r / 2.0 # => 0.375
r / 0.5 # => 1.5
r / Rational(1, 2) # => (3/2)...

Rational#<=>(other) -> -1 | 0 | 1 | nil (14.0)

self と other を比較して、self が大きい時に 1、等しい時に 0、小さい時に -1 を返します。比較できない場合はnilを返します。

...@param other 自身と比較する数値

@return -1 か 0 か 1 か nil を返します。

//emlist[例][ruby]{
Rational
(2, 3) <=> Rational(2, 3) # => 0
Rational
(5) <=> 5 # => 0
Rational
(2, 3) <=> Rational(1,3) # => 1
Rational
(1, 3) <=> 1 # => -1
Rational
...
...(1, 3) <=> 0.3 # => 1
Rational
(1, 3) <=> nil # => nil
//}...

Rational#==(other) -> bool (14.0)

数値として等しいか判定します。

...@param other 自身と比較する数値

@return self と other が等しい場合 true を返します。
そうでなければ false を返します。

//emlist[例][ruby]{
Rational
(2, 3) == Rational(2, 3) # => true
Rational
(5) == 5 # => true
Rational
(0)...
...== 0.0 # => true
Rational
('1/3') == 0.33 # => false
Rational
('1/2') == '1/2' # => false
//}...

Rational#coerce(other) -> Array (14.0)

自身と other が同じクラスになるよう、自身か other を変換し [other, self] という 配列にして返します。

...other が同じクラスになるよう、自身か other を変換し [other, self] という
配列にして返します。

@param other 比較または変換するオブジェクト

//emlist[例][ruby]{
Rational
(1).coerce(2) # => [(2/1), (1/1)]
Rational
(1).coerce(2.2) # => [2.2, 1.0]
//}...

絞り込み条件を変える

Rational#fdiv(other) -> Float (14.0)

self を other で割った商を Float で返します。 other に虚数を指定することは出来ません。

...は出来ません。

@param other 自身を割る数

//emlist[例][ruby]{
Rational
(2, 3).fdiv(1) # => 0.6666666666666666
Rational
(2, 3).fdiv(0.5) # => 1.3333333333333333
Rational
(2).fdiv(3) # => 0.6666666666666666

Rational
(1).fdiv(Complex(1, 0)) # => 1.0
Rational
(1).fdiv(Complex(0, 1))...

Rational#quo(other) -> Rational | Float (14.0)

商を計算します。

...算します。

@param other 自身を割る数

other に Float を指定した場合は、計算結果を Float で返します。

//emlist[例][ruby]{
r = Rational(3, 4)
r / 2 # => (3/8)
r / 2.0 # => 0.375
r / 0.5 # => 1.5
r / Rational(1, 2) # => (3/2)...

Rational#rationalize(eps = 0) -> Rational (14.0)

自身から eps で指定した許容誤差の範囲に収まるような Rational を返 します。

... Rational を返
します。

eps を省略した場合は self を返します。

@param eps 許容する誤差

//emlist[例][ruby]{
r = Rational(5033165, 16777216)
r.rationalize # => (5033165/16777216)
r.rationalize(Rational(0.01)) # => (3/10)
r.rationalize(Rational(0.1))...

Rational#to_d(nFig) -> BigDecimal (14.0)

自身を BigDecimal に変換します。

...

@param nFig 計算を行う桁数

@return BigDecimal に変換したオブジェクト

@raise ArgumentError nFig に 0 以下を指定した場合に発生します。

//emlist[][ruby]{
require "bigdecimal"
require "bigdecimal/util"
p Rational(1, 3).to_d(3) # => 0.333e0
p Rational(1, 3).to_...
<< < 1 2 3 > >>