[dpdk-dev] [RFC PATCH v2 2/3] lib: add bitrate statistics library

Remy Horton remy.horton at intel.com
Tue Nov 1 02:53:00 CET 2016


On 28/10/2016 15:39, Morten Brørup wrote:
> Comments below.
[..]
> When working with statistical calculations using integer arithmetic,
> you should round off the integer result by adding 0.5 to the result,
> which you do by adding half of the divisor to the dividend, like
> this:
>
> delta = (delta * alpha_percent + 50) / 100;
>
> The numbers in this particular case are probably very big, so not
> rounding off doesn't affect the result a lot; but then you should add
> a comment about why rounding down is acceptable.

A minor point, but will roll it into the next patchset.


More information about the dev mailing list