Re: Timestamp precision and rounding

From: Jeff Boes <jboes(at)nexcerpt(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Timestamp precision and rounding
Date: 2004-06-07 18:08:36
Message-ID: 40C4AF24.1060909@nexcerpt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo wrote:

>On Thu, 3 Jun 2004, Jeff Boes wrote:
>
>
>
>>(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)?
>>
>>
>
>My first guess would be that your system probably implements its default
>rounding as nearest even for .5 results, what does 9:00:01.5 give you?
>
>
2004-05-27 09:00:02, so I guess that would confirm it.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander S. 2004-06-07 18:11:33 bug in 7.4.2, concern unicode and russian content of db
Previous Message Bill Moran 2004-06-07 17:04:08 Re: postgres on SuSE 9.1