From: Sky Yin Date: 2006-01-15T11:30:03+09:00 Subject: Re: Duration between two days ------=_Part_41776_31497137.1137292190211 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks, Joe and David. Although I don't quite understand the science behind that, add a bit more ".to_i" is enough for me. On 1/14/06, David Vallner wrote: > > On Sat, 14 Jan 2006 16:52:41 +0100, Sky Yin wrote: > > > > > Basic math tells me 2/1 =3D 2, so what's the point of returning Rationa= l > > instead of Fixnum here? > > > > Because the code calculates in rationals? > > You might want to 'require "mathn"' on the beginning of the script if it > bugs you, the module causes Ruby math to work more... err... > mathemathically. E.g.: > > irb(main):001:0> Rational(2, 1) > =3D> Rational(2, 1) > irb(main):002:0> require "mathn" > =3D> true > irb(main):003:0> Rational(2, 1) > =3D> 2 > > As always after doing deeper magic, be on the lookout for bugs the module > could introduce. > > David Vallner > > ------=_Part_41776_31497137.1137292190211--