BucketedTimeSeries: fix type converison issues computing avg()
Summary:
D527040 had a bug in the code to compute the average: it incorrectly
performed unsigned division when ValueType was a signed integer type.
As a result, the average was reported incorrectly for stats with
negative values.
This makes the average code more intelligent when handling type
conversions: if the caller wants a floating point value, or if the input
type is floating point, floating point division is always returned.
Otherwise, if the input is a signed type, signed integer division is
performed. Otherwise, unsigned integer division is performed.
Test Plan: beholdunittests
Reviewed By: lars@fb.com
FB internal diff:
D553583