Modified Dietz method: Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 452:
==Java method for modified Dietz return==
<syntaxhighlight lang="java">
private static double modifiedDietz (double emv, double bmv, double cashFlow[], int numCD, int numD[]) {
 
/* emv: Ending Market Value
Line 467:
 
if (numCD <= 0) {
throw new ArithmeticException ("numCD <= 0");
}
 
for (int i=0; i<cashFlow.length; i++) {
if (numD[i] < 0) {
throw new ArithmeticException ("numD[i]<0 , " + "i=" + i);
}
weight[i] = (double) (numCD - numD[i]) / numCD;