467,920 Members | 1,179 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,920 developers. It's quick & easy.

Exception class EInvalidOp: invalid floating point operation (x-posted w/ borland.cppbuilder.cpp)

Hello,

I am working on a project in Borland Developer Studio 2006, and am
running into an error I
don't understand. Here is the relevant code:

//---------------------------------------------------
double splitLoc = 0, fs = 512;
double timeRange[3];
int tArr[3];

// these values come from a file, and just happen to be in the one I am
using now
timeRange[0] = -1.5;
tArr[0] = 0;
tArr[2] = 0;

// This is where the error occurs
splitLoc += timeRange[0] * fs; //this is fine
splitLoc += (double)(tArr[2] - tArr[0]);
//----------------------------------------------------

This last line always throws the exception:
First chance exception at $7C81EB33. Exception class EInvalidOp with
message 'Invalid floating point operation'. Process test.exe (3040)

The program compiles fine, so what else could be causing this?
Thanks!
Adam

Feb 19 '06 #1
  • viewed: 8701
Share:
2 Replies
In article <11**********************@o13g2000cwo.googlegroups .com>,
"jawilson" <ja******@cae.wisc.edu> wrote:
Hello,

I am working on a project in Borland Developer Studio 2006, and am
running into an error I
don't understand. Here is the relevant code:

//---------------------------------------------------
double splitLoc = 0, fs = 512;
double timeRange[3];
int tArr[3];

// these values come from a file, and just happen to be in the one I am
using now
timeRange[0] = -1.5;
tArr[0] = 0;
tArr[2] = 0;

// This is where the error occurs
splitLoc += timeRange[0] * fs; //this is fine
splitLoc += (double)(tArr[2] - tArr[0]);
//----------------------------------------------------

This last line always throws the exception:
First chance exception at $7C81EB33. Exception class EInvalidOp with
message 'Invalid floating point operation'. Process test.exe (3040)

The program compiles fine, so what else could be causing this?
Thanks!
Adam


I wrapped your code in main and it works fine... If that last line is
throwing an exception, it's being cause by something other than what you
posted. Chances are, some code is going past an array boundary.

--
Magic depends on tradition and belief. It does not welcome observation,
nor does it profit by experiment. On the other hand, science is based
on experience; it is open to correction by observation and experiment.
Feb 19 '06 #2
When I opened the project in C++Builder 6 instead of the new version
(BDS 2006), it ran fine. Nothing in the code changed, and I'm pretty
certain that the code is not going past an array boundary. This seems
to be a borland config issue, and not a C++ issue now, but I'm still
hoping someone might have an answer.
Adam

Feb 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by Allin Cottrell | last post: by
13 posts views Thread by Chris Stankevitz | last post: by
2 posts views Thread by Martin Manns | last post: by
4 posts views Thread by mathieu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.