Precision when substracting two values with SQL

Поиск
Список
Период
Сортировка
Искать
От
Juancho
Тема
Precision when substracting two values with SQL
Дата
Msg-id
3D58132C.6040303@maxiconsumo.com
Список
Дерево обсуждения
Re: Precision when substracting two values with SQL Jean-Luc Lachance <jllachan@nsd.ca>
Hello:
	I have a problem substracting two values whith SQL.  Please
consider this cases...

ciudadela=# select 0.2-0.2;
 ?column? 
----------
        0
(1 row)

	That's OK for me,


ciudadela=# select 0.2-0.21;
       ?column?       
----------------------
 -0.00999999999999998
(1 row)

	I was hoping -0.01,


ciudadela=# select 0.21-0.22;
 ?column? 
----------
    -0.01
(1 row)

	Again, that's OK for me,


	My question is why is this behavior taking place (the second case),
 and how can I avoid it.
	Any suggestion would be really appreciated.
	Thanks,


Juan Manuel
Buenos Aires
Argentina


В списке pgsql-admin по дате отправления
От: Michael Zouroudis
Дата:
Сообщение: problem with my insert
От: Tim Ellis
Дата:
FAQ