yuck math
This commit is contained in:
@@ -16,6 +16,12 @@ public class MathUtil
|
||||
return values.Sum();
|
||||
}
|
||||
|
||||
public float ListSum(List<float> values)
|
||||
{
|
||||
// Sum the list starting with an initial value of 0
|
||||
return values.Sum();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to create the cumulative sum of all list elements
|
||||
/// ListCumSum([1, 2, 3, 4]) = [1, 3, 6, 10]
|
||||
|
||||
@@ -10,7 +10,7 @@ public class MathUtilTests
|
||||
[TestMethod]
|
||||
public void ListSumTest()
|
||||
{
|
||||
var test = new List<double>
|
||||
var test = new List<float>
|
||||
{
|
||||
1.1f,
|
||||
2.1f,
|
||||
|
||||
Reference in New Issue
Block a user