Precision problems with float8 - Mailing list pgsql-general

From Gabriel Fernandez
Subject Precision problems with float8
Date
Msg-id 3BEBFA27.154467F3@unica.edu
Whole thread Raw
Responses Re: Precision problems with float8
List pgsql-general
Hi,

I send a week ago a mail and I have not get any answer.

The main thing I want to know is: If I use the numeric type instead of
float8 will it result in a slower overall performance or it won't be
significantly different ?

As I posted I have some problems when I execute round(number,precision)
and use it in arithmetical operations: 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

(Of course, the initial 9.38 is the result of a previous calculation,
rounded with two decimals places, but the only thing you can see in the
value of the field is "9.38" ).

Does anyone know the reason ?

Thanks for your attention,

Gabi :-)


pgsql-general by date:

Previous
From: Francisco Reyes
Date:
Subject: Re: Disable Transaction - plans ?
Next
From: Paul Tomblin
Date:
Subject: General question about DBI/DBD