On Mon, 11 Apr 2005 05:57 am, Tom Lane wrote:
> "Roman Schayuk" <[EMAIL PROTECTED]> writes:
> > gap=> select round(42.5);
> >  round
> > -------
> >     42
> > (1 row)
> > Result has to be 43
> 
> No, the above is perfectly correct and in fact required by the IEEE
> standard for floating-point arithmetic (because round-to-nearest-even
> is the default rounding mode).
> 
That is rounding of unrepresentable numbers, is it not?  at least
http://www.ee.ucla.edu/~vandenbe/103/flpt.pdf suggests that to me as I couldn't 
find
the IEEE spec about this.  I'm sure somebody has it at hand, but I don't.


Either way 8.0.1 round differently;

test=# select version();
                                                         version
--------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 8.0.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.2 
20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)
(1 row)

test=# select round(42.5);
 round
-------
    43
(1 row)

test=# select round(42.5,0);
 round
-------
    43
(1 row)



> If anything needs to be changed here, it's the behavior of round(numeric).
> 
So I would say that the round behaviour has changed as Tom has suggested, but 
which is correct?

7.2, or 8.0?

Regards

Russell Smith

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to