Commit 19c93e54 authored by stefanwessel's avatar stefanwessel
Browse files

git-svn-id: https://svn.rwth-aachen.de/repos/sw440870_load_leveller/trunk@53 36cca2a8-63f0-4188-8a56-663e3b0d1cf3
parent d5df2180
......@@ -139,11 +139,8 @@ void observable :: get_statistics(ostream& os) {
os<<"\n";
os << "Bins = " << bins() << "\n";
os << "BinLength = " << bin_length() << "\n";
//double ndigm=log(fabs(mean_v[0][j])) / log(10.);
//double ndige=log(fabs(error_v[error_v.size()-1][j])) / log(10.);
//int diffdig=(int)(ndigm-ndige);
//os.precision(abs(diffdig)+3);
//os.precision((int)(fabs((log(error_v[error_v.size()-1][j])/log(10.))))+3);
os.precision(calcprec(origprec,mean_v[0][j],error_v[error_v.size()-1][j]));
os << "Mean = " << mean_v[0][j]<<"\n";
os.precision(3);
os << "Error = " << error_v[error_v.size()-1][j] <<"\n";
......@@ -155,6 +152,7 @@ void observable :: get_statistics(ostream& os) {
os << " ReBinLength = "<< length
<< " Bins = " << n;
//os.precision((int)(fabs((log(error_v[i][j])/log(10.))))+3);
os.precision(calcprec(origprec,mean_v[0][j],error_v[error_v.size()-1][j]));
os << " Mean = " << mean_v[i][j];
os.precision(3);
os << " Error = "<< error_v[i][j]
......
......@@ -105,6 +105,16 @@ class observable
bool analysis_done;
bool simple_analysis_done;
streamsize calcprec(streamsize origprec, double m, double e) {
if (fabs(e)>1e-200) {
if (fabs(m/e)>1e-200)
return (streamsize)(3. + 0.43429448*log(fabs(m/e)));
else
return 3;
}
return (origprec>16) ? origprec: 16;
}
};
template <class T>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment