I reported the following bug to -bugs, and I'd like to discuss whether we need to fix the issue or how to fix it.
"ITAGAKI Takahiro" <itagaki.takah...@oss.ntt.co.jp> wrote: > Bug reference: 4660 > 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. > > postgres=# SELECT pg_catalog.trunc((-0.1)::float8); > -0 > postgres=# SELECT pg_catalog.ceil((-0.1)::float8); > -0 > postgres=# SELECT pg_catalog.round((-0.1)::float8); > -0 We already have some codes to avoid -0 float8um (unary minus), but there are no protection in trunc(), ceil() and round() at least. It is platform-dependent behavior (msvcrt doesn't return -0), and there is a difference between float8 and numeric (numeric doesn't support -0). 1. Remove 'avoid -0' from float8um because -0 is a possible value for floating point numbers. 2. Add 'avoid -0' codes to those functions. (Are there any places where we also add it?) 3. Move 'avoid -0' codes to float8out() and float8send(). '-0' could be stored in database, but users receives only '+0'. Fixes might be needed by float4 versions. I'll write a patch when we come to a decision. Regards, --- ITAGAKI Takahiro NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers