Chromium Code Reviews| Index: tracing/tracing/base/math.html |
| diff --git a/tracing/tracing/base/math.html b/tracing/tracing/base/math.html |
| index b6f7fd58d061b7d66cec3b548ae5e8cf8c769dd3..1ce443704f84769cad45db14e54c4bb5a291611e 100644 |
| --- a/tracing/tracing/base/math.html |
| +++ b/tracing/tracing/base/math.html |
| @@ -11,6 +11,12 @@ found in the LICENSE file. |
| 'use strict'; |
| tr.exportTo('tr.b', function() { |
| + function round(number, opt_ndigits) { |
| + opt_ndigits = opt_ndigits || 1; |
|
benjhayden
2015/09/25 02:01:18
This prevents setting opt_ndigits = 0. I don't kno
|
| + var k = Math.pow(10, opt_ndigits); |
| + return Math.round(number * k) / k; |
| + } |
| + |
| function clamp(x, lo, hi) { |
| return Math.min(Math.max(x, lo), hi); |
| } |
| @@ -104,6 +110,7 @@ tr.exportTo('tr.b', function() { |
| } |
| return { |
| + round: round, |
| clamp: clamp, |
| lerp: lerp, |
| normalize: normalize, |