Problems of precision with float8 type

Поиск
Список
Период
Сортировка
От Gabriel Fernandez
Тема Problems of precision with float8 type
Дата
Msg-id 3BE6C3B1.9C3A1FC6@unica.edu
обсуждение исходный текст
Список pgsql-general
Hi,

 I have some precision poblems using float8 type.

Look at this:

compta=> select import from apunts where assent = 4 ;

  import
---------
   9.38

AND THEN:

compta=> select import - round(import,2)::float8 as substraction from
apunts where assent = 4 ;

        substraction
---------------------------
-1.77635683940025e-15

What is the cause of this ?

This is just the most simple example of the problem, but things get
worse when you use aggregate functions (sum , etc) and substraction ...

If I use the numeric type the problem just vanishes. But, Does the use
of numeric type instead of float8 results in a slower performance ?

Thanks,

Gabi :-)



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

Предыдущее
От: "Kenneth Skiles"
Дата:
Сообщение: functions, shell script
Следующее
От: mbenzid@yahoo.de (Mounir Benzid)
Дата:
Сообщение: How can I control whether to execute a query or not?