From: matz@... (Yukihiro Matsumoto) Date: 2001-07-29T23:07:50+09:00 Subject: [ruby-talk:18743] Re: Numbers classes.. Rational number? [was: Ruby as opposed to Python?] Hi, In message "[ruby-talk:18732] Numbers classes.. Rational number? [was: Ruby as opposed to Python?]" on 01/07/29, Kent Dahl writes: |Is there any Rational classes out there? I scanned thru the RAA before I |wrote my current hack, but couldn't see any. It is bundled in the standard distribution (well, I should finish "Ruby Essentials" early). require "rational" a = Rational(5,2) And Ruby can even provide Jean Michel's proposal already. |> 5/2==5/2 |> (the Rational number 5/2). Ruby has big ints, it should also |> have Rationals :) require "mathn" p 5/2 # => 5/2 In message "[ruby-talk:18734] Re: Numbers classes.. Rational number? [was: Ruby as opposed to Python?]" on 01/07/29, Kero van Gelder writes: |which raises the question: | | Rational(5, 2) / 3.0 => Rational? Float? Float. require "mathn" p 5/2/3.0 # => 0.8333333333 matz.