C++Math evaluating incorrectly
- by Hayden
I thought I can make life a little easier in data statistics by making a small program which returns the results of sampling distribution of the mean (with standard error). It does this part successfully but in an attempt to return the z-score by using the formula I found here, it returns -1#IND. My interpretation of that formula is:
((1/(sqrt(2*pi)*stdev))*pow(e, (normalpow))
where
double normalpow=-0.5*((mean-popmean)*(mean-popmean)/stdev)
I did a little more investigating and found that (mean-popmean)*(mean-popmean) was evaluating to 0 no matter what. How can I get around this problem of normalpow evaluating to 0.