From: David MacMahon Date: 2013-08-02T01:53:29+09:00 Subject: [ruby-core:56307] Re: [ruby-trunk - Feature #8430] Rational number literal On Aug 1, 2013, at 12:53 AM, takuto_h (Takuto Hayashi) wrote: > If we accept "1.2r" as "Rational(12, 10)": > 1/3r #=> (1/3) > 0.4/1.2r #=> 0.33333333333333337 > > I think this feature's point is that "1/3r" can be seen as "1/3" followed by "r", > so it can make us confusing that "0.4/1.2" followed by "r" is not a rational number. I haven't looked at the implementation, but my understanding was that 1/3r was seen as 1 divided by Rational(3,1). With that interpretation, I think 0.4/1.2r is not confusing: 0.4/1.2r is a Float (i.e. 0.4) divided by a Rational (i.e. Rational(12,10) or 1.2r). Float divided by Rational gives Float. To end up with a Rational result, use 0.4r/1.2r. > The attached file is a patch which accept "3r" and doesn't accept "1.2r". I very much like the idea of "1.2r", let's please keep accepting 1.2r. Thanks, Dave