mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 826439 - use floats instead of doubles for exponential histogram statistic calculations; r=vdjeric
This commit is contained in:
parent
4da7f9b90e
commit
96c005f6f9
@ -746,7 +746,7 @@ void Histogram::SampleSet::AccumulateWithExponentialStats(Sample value,
|
||||
size_t index) {
|
||||
Accumulate(value, count, index);
|
||||
DCHECK_GE(value, 0);
|
||||
double value_log = log(static_cast<double>(value) + 1);
|
||||
float value_log = logf(static_cast<float>(value) + 1.0f);
|
||||
log_sum_ += count * value_log;
|
||||
log_sum_squares_ += count * value_log * value_log;
|
||||
}
|
||||
|
@ -30,8 +30,11 @@ function test_histogram(histogram_type, name, min, max, bucket_count) {
|
||||
// verify properties
|
||||
do_check_eq(sum, s.sum);
|
||||
if (histogram_type == Telemetry.HISTOGRAM_EXPONENTIAL) {
|
||||
do_check_eq(log_sum, s.log_sum);
|
||||
do_check_eq(log_sum_squares, s.log_sum_squares);
|
||||
// We do the log with float precision in C++ and double precision in
|
||||
// JS, so there's bound to be tiny discrepancies. Just check the
|
||||
// integer part.
|
||||
do_check_eq(Math.floor(log_sum), Math.floor(s.log_sum));
|
||||
do_check_eq(Math.floor(log_sum_squares), Math.floor(s.log_sum_squares));
|
||||
do_check_false("sum_squares_lo" in s);
|
||||
do_check_false("sum_squares_hi" in s);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user