Re: round() function wrong?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Michael Brusser <michael(at)synchronicity(dot)com>, "Jochen Westland [invigo]" <jochen(dot)westland(at)invigo(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: round() function wrong?
Date: 2003-10-27 22:53:04
Message-ID: 17313.1067295184@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"scott.marlowe" <scott(dot)marlowe(at)ihs(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-10-28 01:24:53 Re: Defaults for GUC variables (was Re: pg_ctl reports
Previous Message Bruce Momjian 2003-10-27 21:59:50 Re: Still a few flaws in configure's default CFLAGS selection