Closed kornysietsma closed 4 years ago
Oh, good point. I don't remember there being a real reason for returning u64 for stddev/stdvar/mean. I probably just did it to be consistent with the types returned for percentiles.
I'd be open to changing the API and releasing a new major version. It's important to remember that since the histogram stores counts for approximate values, we may still return values that don't seem right if we know the exact inputs.
If you submit a PR, I would be happy to review.
I understand that all the values in the histogram are
u64
- that makes sense - but why are the statistics all converted tou64
as well?This isn't such a problem for percentiles (as they at least have the range of the original inputs) - but for standard deviation, it produces heavily truncated results if the input doesn't have a lot of variation.
It would be very nice to have
f64
versions of these functions - I note that most of them are internally calculated asf64
and then converted tou64
on return.(Actually I just discovered
stddev
is even worse!stdvar
produces af64
value, then truncates it tou64
. And thenstddev
converts it back to af64
, takes the square-root, and truncates tou64
again)