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

Unified Diff: client/dom/benchmarks/common/Math2.dart

Issue 9374026: Move dromaeo to third_party (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved Dromaeo to third party. Created 8 years, 10 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 | « client/dom/benchmarks/common/JSON.dart ('k') | client/dom/benchmarks/common/common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dom/benchmarks/common/Math2.dart
diff --git a/client/dom/benchmarks/common/Math2.dart b/client/dom/benchmarks/common/Math2.dart
deleted file mode 100644
index c615eb37da4ab7ae5cb3a17aed5a0d8d358422b2..0000000000000000000000000000000000000000
--- a/client/dom/benchmarks/common/Math2.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Various math-related utility functions.
-
-class Math2 {
- /// Computes the geometric mean of a set of numbers.
- /// [minNumber] is optional (defaults to 0.001) anything smaller than this
- /// will be changed to this value, eliminating infinite results.
- static double geometricMean(List<double> numbers,
- [double minNumber = 0.001]) {
- double log = 0.0;
- int nNumbers = 0;
- for (int i = 0, n = numbers.length; i < n; i++) {
- double number = numbers[i];
- if (number < minNumber) {
- number = minNumber;
- }
- nNumbers++;
- log += Math.log(number);
- }
-
- return nNumbers > 0 ? Math.pow(Math.E, log / nNumbers) : 0.0;
- }
-
- static int round(double d) {
- return d.round().toInt();
- }
-
- static int floor(double d) {
- return d.floor().toInt();
- }
-
- // TODO (olonho): use d.toStringAsFixed(precision) when implemented by DartVM
- static String toStringAsFixed(num d, int precision) {
- String dStr = d.toString();
- int pos = dStr.indexOf('.', 0);
- int end = pos < 0 ? dStr.length : pos + precision;
- if (precision > 0) {
- end++;
- }
- if (end > dStr.length) {
- end = dStr.length;
- }
-
- return dStr.substring(0, end);
- }
-}
« no previous file with comments | « client/dom/benchmarks/common/JSON.dart ('k') | client/dom/benchmarks/common/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698