C++Math evaluating incorrectly

Posted by Hayden on Stack Overflow See other posts from Stack Overflow or by Hayden
Published on 2012-11-13T22:56:07Z Indexed on 2012/11/13 22:59 UTC
Read the original article Hit count: 219

Filed under:

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.

© Stack Overflow or respective owner

Related posts about c++