INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Very weird variant of "Invalid floating point operation" error

Very weird variant of "Invalid floating point operation" error

Very weird variant of "Invalid floating point operation" error

(OP)
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 --> delphi

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 --> delphi

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

RE: Very weird variant of "Invalid floating point operation" error

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

RE: Very weird variant of "Invalid floating point operation" error

(OP)
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

RE: Very weird variant of "Invalid floating point operation" error

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...

RE: Very weird variant of "Invalid floating point operation" error

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close