Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > invalid floating point operation when accessing vector element

Reply
Thread Tools

invalid floating point operation when accessing vector element

 
 
marko.suonpera@24net.zzn.com
Guest
Posts: n/a
 
      01-05-2007

I'm using the Newmat library where element access in ColumnVector type
is defined as follows:

typedef double Real;

Real& ColumnVector:perator()(int m)
{
REPORT
if (m<=0 || m> nrows) Throw(IndexException(m,*this));
return store[m-1];
}

Real ColumnVector:perator()(int m) const
{
REPORT
if (m<=0 || m> nrows) Throw(IndexException(m,*this));
return store[m-1];
}

(store is a Real* )

Now I call a function with columnvector argument:

ColumnVector a;

//set values of a
//....

double temp = a(1);
func(a);

void func(const ColumnVector &a)
{
double temp = a(1); //invalid floating point operation
}

The first element access double temp = a(1) in the calling function
works ok. In function func() this causes invalid floating point
operation. The message says "Project XXX raised exception class
C0000092 with message "floating point stack check at 0x429191."
Process stopped." If I check the contents of ColumnVector::store with
the debugger, it shows the correct value without problems.

However, if I change the function definition to without const: void
func(ColumnVector &a), it works ok. Also there are other functions of
similar type (with const definition), which work ok. What would cause
this problem?

BR, Marko

 
Reply With Quote
 
 
 
 
marko.suonpera@24net.zzn.com
Guest
Posts: n/a
 
      01-05-2007

And to be more exact the exception is thrown on the line

return store[m-1];

 
Reply With Quote
 
 
 
 
marko.suonpera@24net.zzn.com
Guest
Posts: n/a
 
      01-05-2007

Ok, this seems to have been caused by the previous function, which
should have returned a double but didn't.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
floating point problem... floating indeed :( teeshift Ruby 2 12-01-2006 01:16 AM
Exception class EInvalidOp: invalid floating point operation (x-posted w/ borland.cppbuilder.cpp) jawilson C++ 2 02-19-2006 10:30 PM
Free memory allocate by a STL vector, vector of vector, map of vector Allerdyce.John@gmail.com C++ 8 02-18-2006 12:48 AM
When I try to run WinMpg I get a "invalid floating point operation" window ... what now???? Thanks Daveyboy Computer Support 1 10-28-2003 04:58 AM



Advertisments