Re: BUG #14046: Bad mathematical rules for 0 cast

Поиск
Список
Период
Сортировка
От John McKown
Тема Re: BUG #14046: Bad mathematical rules for 0 cast
Дата
Msg-id CAAJSdjhfjrtzPjtNbf=qGeD1o+cwxfYLo_9nB2_AsVODQB7Gog@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #14046: Bad mathematical rules for 0 cast  (jaroslaw.stoklosa@nomino.pl)
Ответы Re: BUG #14046: Bad mathematical rules for 0 cast  (Jarosław Stokłosa <jaroslaw.stoklosa@nomino.pl>)
Список pgsql-bugs
On Fri, Mar 25, 2016 at 3:56 AM, <jaroslaw.stoklosa@nomino.pl> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      14046
> Logged by:          Jaros=C5=82aw Stok=C5=82osa
> Email address:      jaroslaw.stoklosa@nomino.pl
> PostgreSQL version: 9.4.5
> Operating system:    x86_64-redhat-linux-gnu
> Description:
>
> Below query should return 2 times TRUE.
>
> SELECT cast('+0' as FLOAT) =3D cast('-0' as FLOAT), cast('+0' as FLOAT)::=
TEXT
> =3D cast('-0' as FLOAT)::TEXT
>
> +0 and -0 should be casted to +0 or 0.
>

=E2=80=8BI humbly disagree with you. PostgreSQL use IEEE 754 for floating p=
oint
(mainly because that is what most - not all - computers today use). IEEE
754 distinguishes +0 (or just 0) from -0. cast('-0' as FLOAT) results in an
IEEE 754 negative zero. Which is not identically equal to a positive zero.
The case to TEXT should, and does, preserve this non-identical difference. =
=E2=80=8B



>
> Regards
>
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>



--=20
How many surrealists does it take to screw in a lightbulb? One to hold the
giraffe and one to fill the bathtub with brightly colored power tools.

Maranatha! <><
John McKown

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

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: Breakage with VACUUM ANALYSE + partitions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #14046: Bad mathematical rules for 0 cast