Timestamp precision and rounding

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Timestamp precision and rounding
Date: 2004-06-03 13:27:54
Message-ID: 5d955e3872d11f3b0bfee0eb938db3e2@news.teranews.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

(asked last week on .questions, no response)

Can anyone explain why this happens? (under 7.4.1)

select '2004-05-27 09:00:00.500001-04' :: timestamp(0) ;

timestamp
---------------------
2004-05-27 09:00:01

select '2004-05-27 09:00:00.500000-04' :: timestamp(0) ;

timestamp
---------------------
2004-05-27 09:00:00

That is, why doesn't the second operation result in the same timestamp
as the first? Is it a floating-point representation issue, or are the
mathematical rules of rounding not being followed correctly (as I
understand them, anyway)?

--
Jeff Boes vox 269.226.9550 ext 24
Database Engineer fax 269.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2004-06-03 13:50:22 Re: A "linking" Question
Previous Message Vikas Rana 2004-06-03 13:13:17 Re: statement level triggers in PostgreSQL , anybody??