Re: round() function wrong?

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: "Jochen Westland [invigo]" <jochen(dot)westland(at)invigo(dot)de>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: round() function wrong?
Date: 2003-10-24 19:26:21
Message-ID: 1067023581.5995.1.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut kirjutas R, 24.10.2003 kell 22:16:
> 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.

Also, which way is up ?

hannu=# select round(0.5);
round
-------
1
(1 row)

hannu=# select round(-0.5);
round
-------
-1
(1 row)

> On systems with IEEE 754 floating point, the default is
> normally to round to the nearest even number.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2003-10-24 19:27:42 Re: PostgreSQL on Novell Netware 6.5.
Previous Message Peter Eisentraut 2003-10-24 19:16:34 Re: round() function wrong?