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

From Tom Lane
Subject Re: Postgres (psql ?) rounds all odd second values to e ven seconds fo r timestamp(0) data type
Date
Msg-id 23983.1043268343@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgres (psql ?) rounds all odd second values to e  (Csaba Nagy <nagy@domeus.de>)
List pgsql-general
Csaba Nagy <nagy@domeus.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

pgsql-general by date:

Previous
From: "David Blood"
Date:
Subject: Re: agregates
Next
From: Tom Lane
Date:
Subject: Re: RULE and more than 10 rewrites.