I am having trouble resolving the Financial.IRR function in C#. I know I have to provide a good guess value so that that error doesn't come, but the problem is that I don't know the inputs. They are generated based on different inputs and added to a list which is passed to the IRR function. The same inputs work in the excel IRR function.
The current array I have is this:
double[] array= new double[] {
-1000000,
12686.114456365202,
12686.114456365202,
12686.114456365202,
12686.114456365202,
12686.114456365202,
12686.114456365202,
12686.114456365202,
12686.114456365202,
12686.114456365202,
12686.114456365202,
0,
0,
....
//The array continues with 351 more 0s.
};
var val = Microsoft.VisualBasic.Financial.IRR(ref array, .01)
Excel returns a value of -0.265712453
Is there some other way I can prevent the error from coming?