From: g0dil Date: Wed, 30 Sep 2009 20:57:58 +0000 (+0000) Subject: Utils: Fix NAN error in Statistics X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=75428b027ecccf77d5230021bf6b8736c4a6955e;p=senf.git Utils: Fix NAN error in Statistics git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1470 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Utils/Statistics.cc b/senf/Utils/Statistics.cc index a22a57e..445e1c4 100644 --- a/senf/Utils/Statistics.cc +++ b/senf/Utils/Statistics.cc @@ -272,7 +272,7 @@ prefix_ void senf::Collector::enter(float min, float avg, float max, float dev) if (max > accMax_) accMax_ = max; if (++i_ >= rank_) { float accAvg (accSum_ / i_); - float accDev (std::sqrt(accSumSq_ / i_ - accAvg*accAvg)); + float accDev (std::max(0.0f,std::sqrt(accSumSq_ / i_ - accAvg*accAvg))); StatisticsBase::enter(accMin_, accAvg, accMax_, accDev); i_ = 0; accMin_ = FLT_MAX;