Subject Floating pointing operations troubles
Author Paulo Albuquerque
Hello,

I'm in trouble in an operation envolving float values. I'm
using Delphi 5 with Interbase 6.0. The problematic routine is:

With Query1 do
begin
first;
while not eof do
begin
Query2.ParamByName('codigo').asstring:=fieldbyname
('IE_produto').asstring;
Query2.prepare;
Query2.open;
Query2.edit;
Query2.fieldbyname('PR_customedio').asfloat:=
(Query2.fieldbyname('PR_saldo').asfloat*
Query2.fieldbyname('PR_customedio').asfloat)+
(fieldbyname('IE_qtdereal').asfloat*
fieldbyname('IE_precocompra').asfloat)/
(Query2.fieldbyname('PR_saldo').asfloat+
fieldbyname('IE_qtdereal').asfloat);
Query2.post;
Query2.close;
next;
end;
end;

All the envolved fields in the above calculation are defined
like DOUBLE PRECISION fields. I'm using two TIBQuery connected to two
TIBUpdateSQL.
The problem is that sometimes it works perfectly, sometimes
not. It raises an error "Invalid pointing operation/conversion". I
debuged the program and saw that sometimes some of these operators
are not with the values they should have. Once, one of these
operators show the value "-NAV".
What I have to do ? Should I define these fields as another
Interbase type instead DOUBLE PRECISION ? What is the most trustable
type for floating values ? Am I using the better syntax in Delphi ?
Please, help me...

Thank you in advance,

Paulo Albuquerque de Barros JĂșnior
paulo.albuquerque@...