Re: [BUGS] BUG #4660: float functions return -0

Поиск
Список
Период
Сортировка
От ITAGAKI Takahiro
Тема Re: [BUGS] BUG #4660: float functions return -0
Дата
Msg-id 20090217095333.F17C.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответы Re: [BUGS] BUG #4660: float functions return -0
Список 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.takahiro@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'
codesto 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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Questions about parsing boolean and casting to anyelement
Следующее
От: KaiGai Kohei
Дата:
Сообщение: Re: SE-PostgreSQL and row level security