るりまサーチ

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

ライブラリ

検索結果

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

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