Search Postgresql Archives

Strange round behaviour w/ more than 2 decimals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux