るりまサーチ

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

別のキーワード

  1. optparse on
  2. optionparser on
  3. tracer on
  4. thread abort_on_exception=
  5. thread abort_on_exception

ライブラリ

検索結果

Rational (44061.0)

有理数を扱うクラスです。

...様に Rational.new ではなく、 Kernel.#Rational を使用して
Rational
オブジェクトを作成します。

//emlist[例][ruby]{
Rational
(1, 3) # => (1/3)
Rational
('1/3') # => (1/3)
Rational
('0.33') # => (33/100)
Rational
.new(1, 3) # => NoMethodError
//}

Rational
オブ...
...ジェクトは常に既約(それ以上約分できない状態)である
事に注意してください。

//emlist[例][ruby]{
Rational
(2, 6) # => (1/3)
Rational
(1, 3) * 3 # => (1/1)
//}...