Re: round() function wrong? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: round() function wrong?
Date
Msg-id 17313.1067295184@sss.pgh.pa.us
Whole thread Raw
In response to Re: round() function wrong?  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-hackers
"scott.marlowe" <scott.marlowe@ihs.com> writes:
> So it would appear to be that the automatic assumptions about what is 
> float and what is numeric changed from 7.2 to 7.3, i.e. it's assumed that 
> numeric is the input type.

That's correct.

Looking at the code, round(numeric) always rounds xxx.5 values away from
zero (0.5 -> 1, -0.5 -> -1, etc).  The behavior of round(float) is
platform-dependent, but round-to-nearest-even is the rule used by IEEE
compliant platforms.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Still a few flaws in configure's default CFLAGS selection
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Defaults for GUC variables (was Re: pg_ctl reports