ChensHelpers
Chen.Helpers.MathHelpers.Arithmetic
Arithmetic.Sum(float[], Func<float,float>) Method
Adds all the values contained in the array. Preprocessing each item is possible before they are computed by providing the logic.
e.g. Sum(new float[] { 2f, -4f, 1f }, item => Mathf.Max(0f, item)) will yield a result of 3f.
public static float Sum(this float[] numbers, System.Func<float,float> preProcess=null);
Parameters
numbers
System.Single[]
Array of numbers
preProcess
System.Func<System.Single,System.Single>
Preprocessor code
Returns
System.Single
Sum of the values in the array