Closed bjgallag closed 2 years ago
Find root is definitely challenged. In this case, Xirr succeeds if you give a guess of -0.97 or -0.98, but fails with -0.96 or higher. So right now, you just need to guess better 😅 . It's interesting that changing the precision fixes the problem. Worth looking at this. Thanks for diagnosing the issue.
I committed the proposed change. It passed all the tests including the "console" interop tests. It's resting in the feature/issue-27 branch. I want to release the netcore replatforming out first without code changes. So I'll target this for a following bugfix release.
Description
Microsoft's documentation for the XIRR function states under the Remarks section that they guarantee 1x10^-6 accuracy; however, this library is using 1x10^-7 accuracy in common.fs findRoot function. Removing one zero would align with Microsoft's standards: https://support.microsoft.com/en-us/office/xirr-function-de1242ec-6477-445b-b11b-a303ad9adc9d
Repro steps
Please provide the steps required to reproduce the problem
Expected behavior
A value should be returned representing the IRR amount, which should be -0.990247691899517.
Actual behavior
Exception is generated saying that the root could not be found.
Known workarounds
N/a This issue can be fixed by changing the precision value in common.fs's findRoot method from 1x10^-7 to 1x10^-6.
Related information