Subject Re: Double precision field problem
Author Adam
--- In firebird-support@yahoogroups.com, "ibrahim bulut" <i.bulut@...>
wrote:
>
>
>
> i am in trouble double precision field with subtract operation
>
>
>
> field1 is double precision
>
> field2 is double precision
>
>
>
> field1's value is 79.69
>
> field2's value is 78.12
>
>
>
> when i subtract field2 from field1 with this sql statement
>
> select field1 - field2 from table1
>
> the result is 1,56999999999999
>
>
>
> the result must be 1,57
>
>
>
> what is the problem

Double Precision is a floating point style number type, not a numeric.
This behaviour is perfectly normal for the datatype you are using. The
problem is you are expecting numeric behaviour.

Read the following article:

http://en.wikipedia.org/wiki/Floating_point

Particularly point 9 (4 is also useful).

Adam