Re: round behavior differs between 8.1.5 and 8.3.7

Поиск
Список
Период
Сортировка
От Robert Morton
Тема Re: round behavior differs between 8.1.5 and 8.3.7
Дата
Msg-id 625201b40904211234k1594a888t7829a4e846fdb24d@mail.gmail.com
обсуждение исходный текст
Ответ на Re: round behavior differs between 8.1.5 and 8.3.7  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Thanks for the explanation, that's exactly the level of detail I need.
-Robert

On Tue, Apr 21, 2009 at 12:00 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Robert Morton <morton2002@gmail.com> writes:
> Perhaps there are platform differences, since the version I am using was
> built with Microsoft Visual Studio:

Ah, now you tell us.

round(float8) just calls the platform's rint() function.  At least on
platforms that have rint(), which maybe Windows doesn't.  In that case
it's going to come down to src/port/rint.c, which is not particularly
careful about the exactly-0.5 case.  I think fully-standards-conformant
versions of rint() are probably going to use a "round to nearest even
integer" rule in such cases.  But by and large, float8 arithmetic *is*
going to have platform-specific behaviors; you're living in a fantasy
world if you think otherwise.

                       regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: PostgreSQL versus MySQL for GPS Data
Следующее
От: David Fetter
Дата:
Сообщение: Re: PostgreSQL versus MySQL for GPS Data