Search Postgresql Archives

Re: Strange round behaviour w/ more than 2 decimals

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

 



On Wed, Jul 11, 2007 at 09:50:25AM -0300, Fernando Madruga Pinheiro wrote:
>  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.

I asked my math teacher a similar question back in 7th grade:

If you round 1.8947 to 1.89 the error is 0.0047. If you round
1.8947 to 1.90 the error is 0.0053.

My numbers where 1.49 and the rounding I proposed was: round to 1
decimals, round to 0 decimals to get 2 out of 1.49. I think he is
correct and that the postgresql function is also correct.

Peter


[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