Re: round() function wrong?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Jochen Westland [invigo]" <jochen(dot)westland(at)invigo(dot)de>
Cc: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: round() function wrong?
Date: 2003-10-24 19:16:34
Message-ID: Pine.LNX.4.44.0310242114120.18767-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jochen Westland [invigo] writes:

> In my version
> select round(2.5); returns 2;
> select round(2.5000001) returns 3;
>
> refering to my math professor thats wrong, at least in germany.
> select round(2.5); should return 3

The convention that .5 values should be rounded up is just that, a
convention. On systems with IEEE 754 floating point, the default is
normally to round to the nearest even number.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2003-10-24 19:26:21 Re: round() function wrong?
Previous Message Marko Karppinen 2003-10-24 19:09:58 Re: Call for port reports