From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [BUGS] BUG #4660: float functions return -0 |
Date: | 2009-02-17 01:14:05 |
Message-ID: | 20090217095333.F17C.52131E4D@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
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(dot)takahiro(at)oss(dot)ntt(dot)co(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-02-17 03:32:13 | Re: [BUGS] BUG #4660: float functions return -0 |
Previous Message | Craig Ringer | 2009-02-16 15:15:12 | Re: BUG #4661: Installation |
From | Date | Subject | |
---|---|---|---|
Next Message | KaiGai Kohei | 2009-02-17 01:44:02 | Re: SE-PostgreSQL and row level security |
Previous Message | Tom Lane | 2009-02-17 01:03:33 | Re: Questions about parsing boolean and casting to anyelement |