Re: Imprecision of DAYS_PER_MONTH

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Imprecision of DAYS_PER_MONTH
Date: 2005-07-21 16:45:06
Message-ID: 200507211645.j6LGj6S03544@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruno Wolff III wrote:
> On Thu, Jul 21, 2005 at 09:39:38 -0400,
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
> >
> > I have added this comment above the DAYS_PER_MONTH macro:
> >
> > + /*
> > + * DAYS_PER_MONTH is very imprecise. The more accurate value is
> > + * 365.25/12 = 30.4375, or '30 days 10:30:00'. Right now we only
> > + * return an integral number of days, but someday perhaps we should
> > + * also return a 'time' value to be used as well.
> > + */
> > #define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
> >
> > Let me add that we could actually do this in many places now because we
> > are already converting to 'time' in those places. Is this a TODO?
>
> Shouldn't you be using 365.2425/12 (30.436875) for the number of days per
> month?

OK, comment updated:

/*
* DAYS_PER_MONTH is very imprecise. The more accurate value is
* 365.2425/12 = 30.436875, or '30 days 10:29:06'. Right now we only
* return an integral number of days, but someday perhaps we should
* also return a 'time' value to be used as well.
*/

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-07-21 16:49:33 Re: Imprecision of DAYS_PER_MONTH
Previous Message Tino Wildenhain 2005-07-21 15:01:23 Re: Imprecision of DAYS_PER_MONTH