Re: Postgres (psql ?) rounds all odd second values to e ven seconds fo r timestamp(0) data type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Csaba Nagy <nagy(at)domeus(dot)de>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>, "'Thomas Lockhart'" <lockhart(at)fourpalms(dot)org>
Subject: Re: Postgres (psql ?) rounds all odd second values to e ven seconds fo r timestamp(0) data type
Date: 2003-01-22 20:45:43
Message-ID: 23983.1043268343@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Csaba Nagy <nagy(at)domeus(dot)de> writes:
> I've looked at the code you mentioned, did some experimenting.
> I still don't understand why the negative case ? What dates would be in that
> range ?

IIRC, our internal representation of timestamps puts time 0 at midnight GMT
1/1/2000. Times before that will be negative.

> In any case, the negative number handling seems not doing the same thing as
> the positive one.

That's what I fixed in the patch I applied on 8 Jan.

> The "rint" implementation on my test box has some inconsistentcies too:

Actually, that behavior of "rounding to nearest even" at an xxx.5
boundary is what is specified by the IEEE float-arithmetic standard.
The numerical-analysis justification for the spec doesn't seem to have
much applicability to datetime calculations, perhaps, but that's what
we're going to get on a lot of platforms.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Copeland 2003-01-22 20:59:53 Re: [HACKERS] C++ coding assistance request for a visualisation
Previous Message David Blood 2003-01-22 20:32:26 Re: agregates