C# IRR 関数に問題があります。「引数が無効です」という例外が発生します。特定のプロジェクトの年ごとに netcash の配列があります。
public double IRR
{
get
{
var operatingYears =
EntProject.ResultYearSet.Where(p => p.YearType == YearTypeEnum.Operating)
.Select(x => (double)x.NetCash)
.ToArray();
return NavitasFormulae.GetInternalRateofReturn(operatingYears);
}
IRR 関数:
public static double GetInternalRateofReturn(double[] values,double guess = 0.0001)
{
try
{
return Financial.IRR(ref values);
}
catch (ArgumentException)
{
// throw new BusinessException(BusinessExceptionEnum.Operational,
// "Cannot calculate IRR from the yearly values");
return 0; //If the series of values are not suitable, then the function will return zero.
}
catch (Exception)
{
throw new BusinessException(BusinessExceptionEnum.Operational,
"The IRR Function encountered an error");
}
}
推測を別の値に変更しようとしましたが、配列にも負の数 (各年の総コストの合計) を渡しましたが、それでもうまくいきませんか?