Board index » delphi » DBE error "Invalid floating point operation"

DBE error "Invalid floating point operation"

This seems to be a {*word*193} one. I searched for other messages like this
but didn't found a solution. Some messages looked like history lessons
because they were Delphi 2. This is the problem:

When i open a TQuery i get an "Invalid floating point operation". This
only happens when i run the program with de Delphi de{*word*81}. Running the
program stand alone *doesn't* give an error. The error occures when
executing the TQuery.Open command. I have tried some thing, setting the
session private en net dir, working with parameters in the qeury and
without them.

The only thing a came across was the use of joins or 'in select'
structures. But not using this means lots of strucles to get the data.
Please help, i'm running out of options.

--
Chris Wesdorp
VSM Automatisering

 

Re:DBE error "Invalid floating point operation"


This exception may be occuring deep inside the VCL which is also being
handled there hence no exceptions when you run it stand-alone. The Delphi
IDE/De{*word*81} catches it for you even if the program has defined a handler
for it.

Is the program displaying a message box when the exception occurs? or it is
being displayed in the de{*word*81} only?

If the exception is being displayed in the de{*word*81} only, then it is being
handled inside the VCL.

I think, only a close examination of the query statement can avoid this
exception.

Sujit

Quote
Chris Wesdorp <ch...@ruma-vsm.nl> wrote in message

news:3eba12a8$1@newsgroups.borland.com...
Quote
> This seems to be a {*word*193} one. I searched for other messages like this
> but didn't found a solution. Some messages looked like history lessons
> because they were Delphi 2. This is the problem:

> When i open a TQuery i get an "Invalid floating point operation". This
> only happens when i run the program with de Delphi de{*word*81}. Running the
> program stand alone *doesn't* give an error. The error occures when
> executing the TQuery.Open command. I have tried some thing, setting the
> session private en net dir, working with parameters in the qeury and
> without them.

> The only thing a came across was the use of joins or 'in select'
> structures. But not using this means lots of strucles to get the data.
> Please help, i'm running out of options.

> --
> Chris Wesdorp
> VSM Automatisering

Re:DBE error "Invalid floating point operation"


Quote
Sujit Singhania wrote:
> This exception may be occuring deep inside the VCL which is also being
> handled there hence no exceptions when you run it stand-alone. The Delphi
> IDE/De{*word*81} catches it for you even if the program has defined a handler
> for it.

> Is the program displaying a message box when the exception occurs? or it is
> being displayed in the de{*word*81} only?

Yes, I have put the query.open in a try..except block, this handles the
exception. When i remove the try..except the de{*word*81} shows a error
dialog with the exception.

Quote

> If the exception is being displayed in the de{*word*81} only, then it is being
> handled inside the VCL.

> I think, only a close examination of the query statement can avoid this
> exception.

I have a similar query that works just fine. If i put a static query (no
params used) in the query component the exception is also raised.

Should i blame Delphi or BDE for this. BTW i use Win 98.

Quote

> Sujit

> Chris Wesdorp <ch...@ruma-vsm.nl> wrote in message
> news:3eba12a8$1@newsgroups.borland.com...

>>This seems to be a {*word*193} one. I searched for other messages like this
>>but didn't found a solution. Some messages looked like history lessons
>>because they were Delphi 2. This is the problem:

>>When i open a TQuery i get an "Invalid floating point operation". This
>>only happens when i run the program with de Delphi de{*word*81}. Running the
>>program stand alone *doesn't* give an error. The error occures when
>>executing the TQuery.Open command. I have tried some thing, setting the
>>session private en net dir, working with parameters in the qeury and
>>without them.

>>The only thing a came across was the use of joins or 'in select'
>>structures. But not using this means lots of strucles to get the data.
>>Please help, i'm running out of options.

>>--
>>Chris Wesdorp
>>VSM Automatisering

Re:DBE error "Invalid floating point operation"


Quote
>Yes, I have put the query.open in a try..except block, this handles the
>exception. When i remove the try..except the de{*word*81} shows a error
>dialog with the exception.

That is not possible. If you are running inside the IDE with
integrated debugging enabled the de{*word*81} will catch the exception
even if the statement that generates it is inside a try/except block.
The only way to prevent this is to enter the exception in the list of
exceptions the de{*word*81} should ignore.

If the statement in in a try/except block you will see one error
dialog. If it is not in a try/except block you will get the de{*word*81}
error dialog. When you close that error dialog and hit F9 to continue
execution you will see a second error dialog. This is the one the user
would see if you were running the app outside the IDE.

If you do not put the query open in a try/except block and if you do
not see the error when you run the program outside the IDE then the
exception is being handled in the VCL and the user will never see it.

By the way, you have not told us what database you are using, what
version of Delphi you are using or what version of the BDE you are
using.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:DBE error "Invalid floating point operation"


What database are you using?

Sujit

Quote
Chris Wesdorp <99004...@si.hhs.nl> wrote in message

news:3eba462d$1@newsgroups.borland.com...
Quote
> While trying things a rebuild the query etc. Now the query has two
> arguments:

> select *
> from breed
> where id = :anyid
> and bvdate in (select max(bvdate)
>                 from breed
>                 where id = :anyid)

> These are filled with either the ParamByName or Params but neither work,
>   the result still is the exception. Trying so i put comment chars for
> the line where the params are set. Now the query doesn't fail! The
> params are integer types and filled with

> query.ParamByName('anyid').AsInteger :=
>      cdsMatch.FieldByName('id').AsInteger;

> Any idea's?

Re:DBE error "Invalid floating point operation"


Quote
Bill Todd wrote:
> <<snip>>

> If you do not put the query open in a try/except block and if you do
> not see the error when you run the program outside the IDE then the
> exception is being handled in the VCL and the user will never see it.

Running in the IDE shows the exception, outside the IDE it doesn't show.

Quote

> By the way, you have not told us what database you are using, what
> version of Delphi you are using or what version of the BDE you are
> using.

Using Delphi 7, Windows 98, BDE 5.2 with Paradox

--
Chris Wesdorp
VSM Automatisering

Re:DBE error "Invalid floating point operation"


Quote
>> If you do not put the query open in a try/except block and if you do
>> not see the error when you run the program outside the IDE then the
>> exception is being handled in the VCL and the user will never see it.
>Running in the IDE shows the exception, outside the IDE it doesn't show.

So the only problem is that the query does not run. Is that correct?
Can you produce the same error using the DBDemos database? If so,
please post the query.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:DBE error "Invalid floating point operation"


Quote
Bill Todd wrote:

  > So the only problem is that the query does not run. Is that correct?
Quote
> Can you produce the same error using the DBDemos database? If so,
> please post the query.

At this time, yes that's true. Before this i had more than one problem
working with floating numbers in the application. When i create a new
application it all works fine. I tried DBDemos orders table, put a lot
of queries dat work with dates and currency values to use as much
doubles as i could but i didn't get the error.

I tried to create a new datamodule with this query but it didn't help.
The table used isn't in use by another program or query, it happens the
first time i read it.

--
Chris Wesdorp
VSM Automatisering

Re:DBE error "Invalid floating point operation"


Quote
Sujit Singhania wrote:
> What database are you using?

Using Delphi 7, Windows 98, BDE 5.2 with Paradox

--
Chris Wesdorp
VSM Automatisering

Re:DBE error "Invalid floating point operation"


Quote
Bill Todd wrote:

  > So the only problem is that the query does not run. Is that correct?
Quote
> Can you produce the same error using the DBDemos database? If so,
> please post the query.

At this time, yes that's true. Before this i had more than one problem
working with floating numbers in the application. When i create a new
application it all works fine. I tried DBDemos orders table, put a lot
of queries dat work with dates and currency values to use as much
doubles as i could but i didn't get the error.

I tried to create a new datamodule with this query but it didn't help.
The table used isn't in use by another program or query, it happens the
first time i read it.

This part of code also failes:

----begin-----
const
    query_date = 'select max(bvdate) as maxdate ' +
                 'from   breedvlb ' +
                 'where  aniid = %d';

begin
       tmpQuery := TQuery.Create(Self);
       tmpQuery.DatabaseName := 'SASDATA';
       tmpQuery.SessionName := 'Default';

       tmpQuery.SQL.Text := Format(query_date,
[cdsMatch.FieldByName('AniId').AsInteger]);
       try
          tmpQuery.Open;
          if (tmpQuery.RecordCount <> 0) then
          begin
             cdsMaxDate.AppendRecord (
                [ cdsMatch.FieldByName('AniId').AsInteger,
                  tmpQuery.FieldByName('MaxDate').AsDateTime ] );
          end;
       finally
          tmpQuery.Close;
          FreeAndNil(tmpQuery);
       end;

       ....more code
----end-----

The query in tmpQuery executes just fine, while stepping through the
code i stop on the line cdsMaxDate.AppendRecord. In the IDE i inspect
the value tmpQuery.FieldByName('MaxDate').AsDateTime it shows the
correct value, but executing the line gives an Invalid pointer
operation. The fields in cdsMaxDate are types integer and date, field
types in cdsMatch are of same types.

Tablestructure breedvlb:
aniid           integer
bvdate          Date
bvkindofvalue   integer
bvfieldnumber   integer
bvfieldvalue    number

--
Chris Wesdorp
VSM Automatisering

Re:DBE error "Invalid floating point operation"


I found something strange. By inspecting the value
tmpQuery.FieldByName('MaxDate').AsDateTime i get the value 37653.
Changing the line to inspect to
DateToStr(tmpQuery.FieldByName('MaxDate').AsDateTime) results in
"Floating point inexact result at 0040BAAB". Tracking this address with
Search -> Find Error goes to the asm of the function DateTimeToTimeStamp
and then stop on the line

0040BAAB D88BD0815700            fmul dword ptr [ebx+FMSecsPerDay]

Maybe it helps you, i don't speak assembler, but i also inspected the
value of ebx which is 5291220 and FMSecsPerDay which is 86400000. The
current EIP is cdsMaxDate.AppendRecord.

--
Chris Wesdorp
VSM Automatisering

Re:DBE error "Invalid floating point operation"


You might try creating a new table and copying the data into it using
DBD. Invalid data or a corrupt table are the only things I can think
of. I have been using the BDE with Paradox tables since version 1 and
have never had the problem you describe so I do not know what else to
suggest.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:DBE error "Invalid floating point operation"


Quote
Bill Todd wrote:
> You might try creating a new table and copying the data into it using
> DBD. Invalid data or a corrupt table are the only things I can think
> of. I have been using the BDE with Paradox tables since version 1 and
> have never had the problem you describe so I do not know what else to
> suggest.

And so i did, and it works. Should have done this earlier. Thanks, now
it the question what killed the table.

--
Chris Wesdorp
VSM Automatisering

Re:DBE error "Invalid floating point operation"


"Chris Wesdorp" <ch...@ruma-vsm.nl> wrote

Quote
> I found something strange. By inspecting the value
> tmpQuery.FieldByName('MaxDate').AsDateTime i get the value 37653.
> Changing the line to inspect to
> DateToStr(tmpQuery.FieldByName('MaxDate').AsDateTime) results in
> "Floating point inexact result at 0040BAAB". Tracking this address with
> Search -> Find Error goes to the asm of the function DateTimeToTimeStamp
> and then stop on the line
> 0040BAAB D88BD0815700            fmul dword ptr [ebx+FMSecsPerDay]

Chris, "Floating point inexact result" is an exception that should not
normally be possible.  Can you insert the following Assert before
the problem or in the except handler block?  It should raise an
exception if the FPU Control Word is set to an abnormal value.
Regards, JohnH

  Assert((GetX87CWand $1F3F) = $1332);
where
  function GetX87CW: word;
  asm
    FStCW [Result]
  end;

Re:DBE error "Invalid floating point operation"


Quote
John Herbster (TeamB) wrote:

  > Chris, "Floating point inexact result" is an exception that should not
Quote
> normally be possible.  Can you insert the following Assert before
> the problem or in the except handler block?  It should raise an
> exception if the FPU Control Word is set to an abnormal value.
> Regards, JohnH

>   Assert((GetX87CWand $1F3F) = $1332);
> where
>   function GetX87CW: word;
>   asm
>     FStCW [Result]
>   end;

I did put the Assert in the try except after the table is opened. But
the result is a failure:

First chance exception at $005197F3. Exception class EAssertionFailed
with message 'Assertion failure (F:\PROG\DELPHI\SAS\DATASASMATCH.PAS,
line 726)'. Process SAS.exe (-563279)

I copied this text out of the event log window. The address is the
Assert function. But when i disable the assert the function seems to
work, it recieves the value of the date field as it should do. Could it
be the processor? I'm using a AMD Athlon 2Gh.

Chris

Go to page: [1] [2]

Other Threads