Re: [GENARAL] round() bug

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENARAL] round() bug
Date: 2014-04-15 16:20:08
Message-ID: 1397578808070-5800118.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Willy-Bas Loos-3 wrote
> Hi,
> I ran into some strange behavior.
> Seems like a bug to me?
>
> wbloos=# select round(0.5::numeric), round(0.5::double precision);
> round | round
> -------+-------
> 1 | 0
> (1 row)

Not a bug; and likely to simple to have escaped notice this long so the
first reaction should be "what am I missing here?"

[google: round .5 postgresql]

http://grokbase.com/t/postgresql/pgsql-hackers/03ap11tckn/round-function-wrong/oldest

Round( numeric ) - 0.5 rounds away from zero
Round( float ) - platform dependent, IEEE 0.5 rounds toward even

You can argue the decision but at this point it's not likely to change.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/GENARAL-round-bug-tp5800087p5800118.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2014-04-15 16:29:04 Re: [GENARAL] round() bug
Previous Message Rob Sargent 2014-04-15 16:02:08 Re: Approach to Data Summary and Analysis