BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Call of StdDev gives error: invalid floating point operation

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language)
View previous topic :: View next topic  
Author Message
Karl
Guest





PostPosted: Wed Apr 05, 2006 11:03 am    Post subject: Call of StdDev gives error: invalid floating point operation Reply with quote



Hi,

I get an error invalid floating point operation using StdDev with BDS
2006. Not every time, but sometimes (therefore the loop in the code).

#include "Math.hpp"
void __fastcall TForm1::Button1Click(TObject *Sender)
{
double *data = new double[3];
for (int i=-1000; i<1000; i++)
{
data[0] = 0.75277265271037 + i*1E-19;
data[1] = 0.75277265271037 + i*1E-19;
data[2] = 0.75277265271037 + i*1E-19;
long double sd = StdDev(data, 2);
}
delete[] data;
}

Does anybody understand this?

After my analysis the calculation of Variance(...), which is used in
StdDev(...), gives a negative value, and the sqrt of a neg. value gives
the error. Actually I get the data from somewhere else, so I should not
change the numbers in just 0.75277265271037.

Karl
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.