Re: BUG #1577: round(dp) function does not round to nearest integer properly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Roman Schayuk" <rschayuk(at)rogers(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1577: round(dp) function does not round to nearest integer properly
Date: 2005-04-10 19:57:04
Message-ID: 12942.1113163024@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Roman Schayuk" <rschayuk(at)rogers(dot)com> 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).

If anything needs to be changed here, it's the behavior of round(numeric).

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-04-10 20:07:35 Re: BUG #1582: boolean DEFAULT TRUE results in FALSE for NULL values
Previous Message Magnus Hagander 2005-04-10 19:45:31 Re: BUG #1579: DO NOT CONNECT