Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CalculateRate(double,double,double,double,double,double)@Rate can calculate a wrong rate. #1226

Open
tohidemyname opened this issue Nov 27, 2023 · 0 comments · May be fixed by #1286
Open

CalculateRate(double,double,double,double,double,double)@Rate can calculate a wrong rate. #1226

tohidemyname opened this issue Nov 27, 2023 · 0 comments · May be fixed by #1286

Comments

@tohidemyname
Copy link

NPOI Version

master

The code is as follows:

private double CalculateRate(double nper, double pmt, double pv, double fv, double type, double guess)
{...
f = Math.Exp(nper * Math.Log(1 + rate));
...}

An early version of POI calculates in the same way:

private double calculateRate(double nper, double pmt, double pv, double fv, doub
...
f = Math.exp(nper * Math.log(1 + rate));
..}

However, the above code is revised:

private double calculateRate(double nper, double pmt, double pv, double fv, doub
...
f = Math.pow(1 + rate, nper);
..}

The patch is as follows:
apache/poi@728c2d3

@tonyqus tonyqus added this to the NPOI 2.7.1 milestone May 6, 2024
@tonyqus tonyqus added the formula label May 6, 2024
@tonyqus tonyqus modified the milestones: NPOI 2.7.1, NPOI 2.7.2 May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants