るりまサーチ

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.005秒)
トップページ > クラス:Rational[x] > クエリ:div[x]

関連するキーワード

  1. bigdecimal

ライブラリ

キーワード

検索結果

Rational#div(other) -> Integer (18108)

self を other で割った整数の商を返します。

...self を other で割った整数の商を返します。

@param other 自身を割る数

例:

Rational
(1, 2).div(Rational(2, 3)) # => 0...

Rational#divmod(other) -> [Integer, Float | Rational] (6101)

self を other で割った、商と余りの配列を返します。

...:

Rational
(3,4).divmod(Rational(2,3)) # => [1, Rational(1, 12)]
Rational
(-3,4).divmod(Rational(2,3)) # => [-2, Rational(7, 12)]
Rational
(3,4).divmod(Rational(-2,3)) # => [-2, Rational(-7, 12)]

Rational
(9,4).divmod(2) # => [1, Rational(1, 4)]
Rational
(9,4).divmod(Rational(2,...
...1)) # => [1, Rational(1, 4)]
Rational
(9,4).divmod(2.0) # => [1, 0.25]

@see Numeric#divmod...

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

自身を other で割った実数の商を返します。

...other で割った実数の商を返します。

@param other 自身を割る数

例:

Rational
(2, 3).fdiv(1) # => 0.6666666666666666
Rational
(2, 3).fdiv(0.5) # => 1.3333333333333333
Rational
(2).fdiv(3) # => 0.6666666666666666...