 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Karl Guest
|
Posted: Wed Apr 05, 2006 11:03 am Post subject: Call of StdDev gives error: invalid floating point operation |
|
|
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 |
|
 |
|
|
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
|
|