Subject Re: [firebird-support] Double precision field problem
Author Svein Erling Tysvaer
You get what you ask for, Ibrahim. Floating point numbers (e.g. double
precision) are good for measuring things, it doesn't matter whether the
length of a line is 1.57 metres or 1.5699999999999 metres. Field1
doesn't have the exact value 79.69, it has a value of approximately
79.69 (e.g. 79.69000000000000001238) and similar for Field2.

If such differences do matter, you should probably use fixed point
numbers - e.g. decimal or numeric.

HTH,
Set

ibrahim 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
>
> ibrahim bulut
> software and database expert
> iletisim online ltd.sti.
> turkish republic