From: Joe Van Dyk Date: 2006-01-15T01:55:08+09:00 Subject: Re: Duration between two days On 1/14/06, Sky Yin wrote: > According to the Rdoc of Date class, operator '-(x)' is described as: > > If x is a Date , 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 > # > >b = Date.new 2004, 1, 3 > # > >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.