The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.
<html>
<head>
<title>Zvonko *</title>
<script>
function getAPR(theForm){
var theLoan = theForm.inpLoan.value*1;
var thePay = theForm.inpRepaiment.value*1;
var theDays = theForm.inpDays.value*1;
theForm.outApr.value="";
if(theLoan&&thePay&&theDays){
theAPR=(thePay-theLoan)/theLoan*100*360/theDays;
theForm.outApr.value=theAPR.toFixed(2);
}
}
</script>
</head>
<body>
<form onKeyUp="getAPR(this)">
<table>
<tr><td>Loan</td><td>
<input type="text" name="inpLoan" ></td></tr>
<tr><td>Repaiment</td><td>
<input type="text" name="inpRepaiment" ></td></tr>
<tr><td>Days</td><td>
<input type="text" name="inpDays" ></td></tr>
<tr><td>APR[%]</td><td>
<input type="text" name="outApr" readonly></td></tr>
</table>
</form>
</body>
</html>
setPPA(52)
function CalcRate() {
var p = getVal(document.input.credit.value);
var i=getVal(document.input.initial.value);
var a=getVal(document.input.repay.value);
var n=Math.floor(getVal(document.input.number.value));
var f=getVal(document.input.last.value);
//Isaac's magic ...
var x=1.0001; var fx=0; var dx=0; var z=0;
do {
fx=i+a*(Math.pow(x,n+1)-x)/(x-1)+f*Math.pow(x,n)-p;
dx=a*(n*Math.pow(x,n+1)-(n+1)*Math.pow(x,n)+1)/Math.pow(x-1,2)+n*f*Math.pow(x,n-1);
z=fx/dx; x=x-z;
//alert("fx="+fx+"\ndx="+dx+"\nz="+z+"\nx="+x)
}
while (Math.abs(z)>1e-9);
r=100*(Math.pow(1/x,m)-1);
document.input.credit.value=TwoDP(p);
document.input.initial.value=TwoDP(i);
document.input.repay.value=TwoDP(a);
document.input.number.value=n;
document.input.last.value=TwoDP(f);
document.getElementById('showapr').innerHTML = "APR : " + OneDP(r) + " %";
document.getElementById('showapr').style.visibility = 'visible';
}
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!