Re: Precision when substracting two values with SQL

Поиск
Список
Период
Сортировка
От Larry Rosenman
Тема Re: Precision when substracting two values with SQL
Дата
Msg-id 1029184021.473.35.camel@lerlaptop.iadfw.net
обсуждение исходный текст
Ответ на Re: Precision when substracting two values with SQL  (Tim Ellis <Tim.Ellis@gamet.com>)
Список pgsql-admin
On Mon, 2002-08-12 at 15:24, Tim Ellis wrote:
> > ciudadela=# select 0.2-0.2;
> >         0
> > ciudadela=# select 0.2-0.21;
> >  -0.00999999999999998
> > ciudadela=# select 0.21-0.22;
> >     -0.01
>
> I also get this on my Postgres 7.2.1, both Linux and Solaris.
You are comparing floats.

This is a STANDARD problem with Base 10 Floating point.

LER

--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


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

Предыдущее
От: Tim Ellis
Дата:
Сообщение: Re: Precision when substracting two values with SQL
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Precision when substracting two values with SQL