Strange round behaviour w/ more than 2 decimals

Поиск
Список
Период
Сортировка
От Fernando Madruga Pinheiro
Тема Strange round behaviour w/ more than 2 decimals
Дата
Msg-id 979602370707110550t6498b049h8bf922421f868ea1@mail.gmail.com
обсуждение исходный текст
Ответы Re: Strange round behaviour w/ more than 2 decimals  (Peter Wiersig <peter@friesenpeter.de>)
Re: Strange round behaviour w/ more than 2 decimals  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi. I'm having some strange round behaviour when using 4 decimals.

If I use ROUND(1.8947, 2), it should return 1.90, but it does return 1.89. Rounding to 3 decimal places, then 2 (eg.: ROUND(ROUND(1.8947, 3), 2) ) then I get 1.90!
This way, when rounding, ROUND is considering only decimal places parameter + 1 to determine which is the rounding (ROUND(1.8951, 2) returns 1.90).

I've tested in 8.1.3 and 8.2.4.

Is it expected to work this way? There's a way to "force" the round to consider all the decimal places?

Thanks,
Fernando Pinheiro

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: odbc parameters
Следующее
От: "Zlatko Matic"
Дата:
Сообщение: Re: odbc parameters