BUG #4660: float functions return -0 - Mailing list pgsql-bugs

From ITAGAKI Takahiro
Subject BUG #4660: float functions return -0
Date
Msg-id 200902161150.n1GBomsH036901@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4660: float functions return -0  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4660
Logged by:          ITAGAKI Takahiro
Email address:      itagaki.takahiro@oss.ntt.co.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)

pgsql-bugs by date:

Previous
From: toruvinn
Date:
Subject: Re: BUG #4656: Indexes not used when comparing nextval() and currval() to integers
Next
From: "Thomas Waelde"
Date:
Subject: BUG #4661: Installation