summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2009-04-06 16:41:54 +0000
committerNanang Izzuddin <nanang@teluu.com>2009-04-06 16:41:54 +0000
commit0ed6c3bf457e0dbd887f8e1e4cb7154bbdb87ab1 (patch)
treed69f7171b4cac26bb3c56348bc0ea9f58dc88ef8 /pjlib
parent38c2e966b6647e0c40a4668da82518cb75ec1408 (diff)
Ticket #772 (misc fix): Updated floating point version of math statistic to return the rounded mean value.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2577 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/include/pj/math.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/pjlib/include/pj/math.h b/pjlib/include/pj/math.h
index 9df5eeb2..8d202dbf 100644
--- a/pjlib/include/pj/math.h
+++ b/pjlib/include/pj/math.h
@@ -140,7 +140,9 @@ PJ_INLINE(void) pj_math_stat_update(pj_math_stat *stat, int val)
#if PJ_HAS_FLOATING_POINT
delta = val - stat->fmean_;
stat->fmean_ += delta/stat->n;
- stat->mean = (int) stat->fmean_;
+
+ /* Return mean value with 'rounding' */
+ stat->mean = (int) (stat->fmean_ + 0.5);
stat->m2_ += (int)(delta * (val-stat->fmean_));
#else