On 1/14/06, Sky Yin <sky.yin / gmail.com> wrote: > 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 = Date.new 2004, 1, 1 > #<Date: 4906011/2,0,2299161> > >b = Date.new 2004, 1, 3 > #<Date: 4906015/2,0,2299161> > >b - a > Rational(2, 1) > > Basic math tells me 2/1 = 2, so what's the point of returning Rational > instead of Fixnum here? It's something to do with Astronomical Julian Days and fractional days.