mirror of https://github.com/apache/poi.git
Wrong computation of functionality.
This commit is contained in:
parent
50a2b9376b
commit
baa0296f78
|
@ -117,12 +117,10 @@ public final class FinanceLib {
|
|||
*/
|
||||
public static double npv(double r, double[] cfs) {
|
||||
double npv = 0;
|
||||
double r1 = r + 1;
|
||||
double trate = r1;
|
||||
for (double cf : cfs) {
|
||||
npv += cf / trate;
|
||||
trate *= r1;
|
||||
}
|
||||
for (int i=0;i<arr.length;i++)
|
||||
{
|
||||
npv+=cfs[i]/Math.pow(1+r,i);
|
||||
}
|
||||
return npv;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue