diff --git a/StockingData/Lib/Math/AverageMath.cs b/StockingData/Lib/Math/AverageMath.cs index 4c7863c..4b55b2c 100644 --- a/StockingData/Lib/Math/AverageMath.cs +++ b/StockingData/Lib/Math/AverageMath.cs @@ -4,6 +4,12 @@ public static class AverageMath { public static double Average(IEnumerable values) { + // 0件の時、NaNになるため、対応 + if (values.Count() == 0) + { + return 0; + } + double sum = values.Sum(); return sum / values.Count(); }