BUG #4660: float functions return -0

From: "ITAGAKI Takahiro" <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4660: float functions return -0
Date: 2009-02-16 11:50:48
Message-ID: 200902161150.n1GBomsH036901@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


The following bug has been logged online:

Bug reference: 4660
Logged by: ITAGAKI Takahiro
Email address: itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp
PostgreSQL version: 8.3.3
Operating system: Fedora 8
Description: float functions return -0
Details:

Float8 versions of trunc(), ceil() and round() could return -0 on some
version of glibc.

We avoid -0 in float8um (unary minus),
but should we add the same codes in those functions?
There is inconsistency compared with numeric version
of funcs and it is a platform-dependent behavior;
0 is returned there.

postgres=# SELECT pg_catalog.trunc((-0.1)::float8);
trunc
-------
-0
(1 row)

postgres=# SELECT pg_catalog.ceil((-0.1)::float8);
ceil
------
-0
(1 row)

postgres=# SELECT pg_catalog.round((-0.1)::float8);
round
-------
-0
(1 row)

postgres=# select version();
version
----------------------------------------------------------------------------
------------------------
PostgreSQL 8.3.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.1
20070105 (Red Hat 4.1.1-51)
(1 row)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Waelde 2009-02-16 12:11:20 BUG #4661: Installation
Previous Message Tomasz Kolaj 2009-02-16 10:28:05 BUG #4659: Can't configure static postgresql with static openssl

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2009-02-16 12:08:11 Re: SE-PostgreSQL and row level security
Previous Message Michael Meskes 2009-02-16 11:33:40 Re: Which installation parts are backward compatible?