blob: bde54eebf0b2e6c6c4bd8a0c8a3e3ce73e003a72 [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:math' as math;
// TODO(jacobr): move more math utils over to this library.
double sum(Iterable<double> numbers) =>
numbers.fold(0, (sum, cur) => sum + cur);
double min(Iterable<double> numbers) =>
numbers.fold(double.infinity, (minimum, cur) => math.min(minimum, cur));
double max(Iterable<double> numbers) =>
numbers.fold(-double.infinity, (minimum, cur) => math.max(minimum, cur));