Re: Rounding incompatibility

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: Havasvölgyi Ottó <havasvolgyi(dot)otto(at)gmail(dot)com>
Cc: Pg - General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Rounding incompatibility
Date: 2009-06-15 14:46:59
Message-ID: 65937bea0906150746p3e073bc9r16d7b14752a8ba97@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jun 15, 2009 at 4:28 PM, Havasvölgyi Ottó <
havasvolgyi(dot)otto(at)gmail(dot)com> wrote:

> Hi,
>
> I have found the following strangeness on Windows versions:
>
> create table round_test (id int primary key, value double precision);
> insert into round_test(id, value) values(1, 1.5);
> insert into round_test(id, value) values(2, -1.5);
> insert into round_test(id, value) values(3, 3.5);
> select round(value) from round_test;
>
> psql 8.2.13 returns
>
> 2
> -2
> 4
>
> But psql 8.3.3 returns
>
> 1
> -1
> 3
>
> Trying more values it seems that 8.2 rounding works according to banker's
> rounding rules.
> Can you confirm this?
> How can I avoid this incompatibility or perhaps bug?
>
>
Posting the output of 'select version()' from both the databases will help
blaming some distribution.

Best regards,
--
Lets call it Postgres

EnterpriseDB http://www.enterprisedb.com

gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com
Mail sent from my BlackLaptop device

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2009-06-15 14:52:52 Re: Rounding incompatibility
Previous Message Tom Lane 2009-06-15 14:33:07 Re: Rounding incompatibility