S
Sky Yin
------=_Part_37943_21369839.1137253947560
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
According to the Rdoc of Date class, operator '-(x)' is described as:
If x is a Date <http://www.ruby-doc.org/core/classes/Date.html>, return the
number of days between the two dates; or, more precisely, how many days
later the current date is than x.
However, a quick test in irb gives me a weird result:
Basic math tells me 2/1 =3D 2, so what's the point of returning Rational
instead of Fixnum here?
Thanks.
------=_Part_37943_21369839.1137253947560--
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
According to the Rdoc of Date class, operator '-(x)' is described as:
If x is a Date <http://www.ruby-doc.org/core/classes/Date.html>, return the
number of days between the two dates; or, more precisely, how many days
later the current date is than x.
However, a quick test in irb gives me a weird result:
require 'date' true
a =3D Date.new 2004, 1, 1
# said:b =3D Date.new 2004, 1, 3
Rational(2, 1)# said:b - a
Basic math tells me 2/1 =3D 2, so what's the point of returning Rational
instead of Fixnum here?
Thanks.
------=_Part_37943_21369839.1137253947560--