blob: 73a5176081fd4f323f9c1e1498da56fa67d11b8b [file]
// Copyright 2021 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
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));