Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very weird variant of "Invalid floating point operation" error 1

Status
Not open for further replies.

oradke

Programmer
Mar 9, 2014
3
DE
Hi all!
I ran into the weirdest problem with an "Invalid floating point operation" error.

I'm using Delphi 2010, analyzing a stream of data. I did some tweaks to the code, added a few new algorithms, and suddenly Delphi threw the above mentioned error at a specific frame of my data. At first I was not surprised, because these things happen when you mess with the code. Problem was: Delphi never told me WHERE exactly the error occured!

Well, I had added my own little debug toy by implementing a form with a memo field. I created a little routine within that form that prints a message to the memo:
Code:
procedure DebugPrint(sMessage: String);
begin
  frmDebug.Show;
  frmDebug.Memo1.Lines.add( chr(10) + chr(13) + sMessage);
End;

Then I added statements into my procedure that does all the data crunching, for instance:
Code:
             if iCurrentFrame > 1760 then
            DebugPrint('CalcLungArea: ' + IntToStr(iCurrentFrame));

With these messages, I wanted to track the progress of the procedure to see where it would break at frame 1763. So far so good, right?

Weird thing is, after I inserted that code, the error has DISAPPEARED. I have no idea why. Any ideas?

Oliver
 
DB programming isn't really my thing and I think that is what you are doing? But the main problem is that you don't give enough information, for example what sort of calcs are you actually doing? This sort of error usually results from misuse of one of the predefined conversion routines e.g. inttostr(), floattostr(). Use the def versions or use val().
Its not unusual for errors to propagate out well past the point where the error occurred, so your trap might not have helped anyway.
I wonder if the streaming you mention is relevant, is your data coming in faster than you can analyse it, so now you have a stop you don't see the error? Dunno more info required.

Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
That's just perfectly normal Paranoia everyone in the universe has that: Slartibartfast
 
Hi Steve!
Thanks for replying.

No, this is not a DB application. I store the data as records in a memory stream and read them sequentially on demand, so there's no timing issue.

I'd love to give you a code example, but since Delphi doesn't tell me WHERE the error occurs, I'm at a loss here! Can hardly paste my whole sourcecode.

Oliver
 
use the debugger Luke!

make sure you set the debugger option "Notify on language exceptions" active and the moment the exeption occurs, look at the call stack..


/Daddy

-----------------------------------------------------
Helping people is my job...
 
YESS!! Daddy was dead-on. The debugger was not set to handle this exception! I enabled it and it pointed me to the culprit: Using a variable array which was declared, but not initialized (stupid error, I know!). That explains the erratic behavior and the arbitrary disappearance of the error when I enabled the debugging form.

Thanks a lot for your help, appreciate it!

Oliver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top