Re: [PR] IRR: fall back to bracketed Newton-Raphson when t he iteration diverges (bug 64137 follow-up) [poi]

falhenaki (via GitHub) <[email protected]>
Newsgroups gmane.comp.jakarta.poi.devel
Message-ID <PR_kwDOAAMmIM7_XbU5-e478e9a1-0452-454f-afea-b33fd5b172cc@gitbox.apache.org>
falhenaki commented on code in PR #1216:
URL: https://github.com/apache/poi/pull/1216#discussion_r3789710722


##########
poi/src/main/java/org/apache/poi/ss/formula/functions/Irr.java:
##########
@@ -130,7 +168,149 @@ public static double irr(double[] values, double guess) {
             x0 = x1;
         }
         // maximum number of iterations is exceeded
-        LOGGER.atWarn().log("Returning NaN because IRR has reached max number of iterations allowed: {}", MAX_ITERATION_COUNT);

Review Comment:
   Those three logs all say "Returning NaN because ...", and after this change that's no longer what happens at those points. A NaN from the Newton loop is now just an internal signal to try the bracketed fallback, it isn't returned to the caller anymore. If I kept the logs where they were, every cash flow the fallback rescues would warn about a NaN the caller never actually sees. So I moved the logs to the two spots where a NaN really is final, the message is accurate there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.