I don't remember what needs to be included for the function "sqrt", but this function looks right to me...didn't try it, but should only need a few changes if any.
double float stddev (float* set, int set_length)
{
int i;
float mean = 0.0;
double float sigma = 0.0;
for (i = 0; i %26lt; set_length; i++)
{
mean += (set[i] / (float) set_length);
}
for (i = 0; i %26lt; set_length; i++)
{
float diff = set[i] - mean;
sigma += (diff * diff);
}
sigma = (sigma / (float) set_length);
return sqrt(sigma);
}
snow of june
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment