Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: tracing/tracing/base/math/running_statistics.html

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/base/math/rect.html ('k') | tracing/tracing/base/math/sorted_array_utils.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/base/math/running_statistics.html
diff --git a/tracing/tracing/base/math/running_statistics.html b/tracing/tracing/base/math/running_statistics.html
index 6fa614aa4b4508597a89f0489a0b7e5dd3496584..bf2103f59696c6965f4acfb045eca5dde41eb075 100644
--- a/tracing/tracing/base/math/running_statistics.html
+++ b/tracing/tracing/base/math/running_statistics.html
@@ -38,14 +38,12 @@ tr.exportTo('tr.b.math', function() {
}
get geometricMean() {
- if (this.meanlogs_ === undefined)
- return 0;
+ if (this.meanlogs_ === undefined) return 0;
return Math.exp(this.meanlogs_);
}
get mean() {
- if (this.count_ === 0)
- return undefined;
+ if (this.count_ === 0) return undefined;
return this.mean_;
}
@@ -62,16 +60,13 @@ tr.exportTo('tr.b.math', function() {
}
get variance() {
- if (this.count_ === 0)
- return undefined;
- if (this.count_ === 1)
- return 0;
+ if (this.count_ === 0) return undefined;
+ if (this.count_ === 1) return 0;
return this.variance_ / (this.count_ - 1);
}
get stddev() {
- if (this.count_ === 0)
- return undefined;
+ if (this.count_ === 0) return undefined;
return Math.sqrt(this.variance);
}
@@ -82,10 +77,11 @@ tr.exportTo('tr.b.math', function() {
this.sum_ += x;
// The geometric mean is computed using the arithmetic mean of logarithms.
- if (x <= 0)
+ if (x <= 0) {
this.meanlogs_ = undefined;
- else if (this.meanlogs_ !== undefined)
+ } else if (this.meanlogs_ !== undefined) {
this.meanlogs_ += (Math.log(Math.abs(x)) - this.meanlogs_) / this.count;
+ }
// The following uses Welford's algorithm for computing running mean
// and variance. See http://www.johndcook.com/blog/standard_deviation.
« no previous file with comments | « tracing/tracing/base/math/rect.html ('k') | tracing/tracing/base/math/sorted_array_utils.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698