Skip to content

Commit

Permalink
Merge Pull Request #3470 from trilinos/Trilinos/stacked-timer-round-off
Browse files Browse the repository at this point in the history
Automatically Merged using Trilinos Pull Request AutoTester
PR Title: Resolved roundoff issue in stddev calc
PR Author: rppawlo
  • Loading branch information
trilinos-autotester authored Sep 20, 2018
2 parents e26b9b1 + 7f6cd43 commit 5257e95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/teuchos/comm/src/Teuchos_StackedTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ StackedTimer::printLevel (std::string prefix, int print_level, std::ostream &os,
if ( options.output_minmax && active_[i]>1) {
os << " {min="<<min_[i]<<", max="<<max_[i];
if (active_[i]>1)
os<<", std dev="<<sqrt((sum_sq_[i]-sum_[i]*sum_[i]/active_[i])/(active_[i]-1));
os<<", std dev="<<sqrt(std::max<double>(sum_sq_[i]-sum_[i]*sum_[i]/active_[i],0.0)/(active_[i]-1));
os << "}";
}
// Output histogram
Expand Down

0 comments on commit 5257e95

Please sign in to comment.