summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stddev.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/stddev.cpp b/stddev.cpp
index 5f4c8a7..b652b8a 100644
--- a/stddev.cpp
+++ b/stddev.cpp
@@ -40,8 +40,10 @@ int main(int,char **argv){
total+=(v-s_mean)*(v-s_mean);
}
const double s_stddev=data.size()==1?nan(""):sqrt(total/(data.size()-1));
+ const double s_stderr=s_stddev/sqrt(data.size());
- cout<<"Mean: "<<s_mean<<endl
- <<"Stddev: "<<s_stddev<<endl
+ cout<<"Mean: "<<s_mean<<'\n'
+ <<"Stddev: "<<s_stddev<<'\n'
+ <<"Stderr: "<<s_stderr<<'\n'
<<"Median: "<<s_median<<endl;
}