Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
as3/javascript贷款公式,用于根据周利率计算原则_Javascript_Html_Actionscript 3_Flash_Math - Fatal编程技术网

as3/javascript贷款公式,用于根据周利率计算原则

as3/javascript贷款公式,用于根据周利率计算原则,javascript,html,actionscript-3,flash,math,Javascript,Html,Actionscript 3,Flash,Math,我有一个AS3函数来计算每周还款值,只要我有贷款金额、利率和期限的年值 private function calculateRepayment(_loanAmount, _years, _interest):Number { var nWeek = _years * 52; var nInterest = _interest/(52*100); var nRepayment = ( _loanAmount * nInterest *Math.pow((1+nInteres

我有一个AS3函数来计算每周还款值,只要我有贷款金额、利率和期限的年值

private function calculateRepayment(_loanAmount, _years, _interest):Number
{
    var nWeek = _years * 52;
    var nInterest = _interest/(52*100);
    var nRepayment = ( _loanAmount * nInterest *Math.pow((1+nInterest),nWeek) ) / ( Math.pow((1+nInterest),nWeek)-1 );
    return Number(nRepayment);
}
现在我需要编写一个函数,根据每周还款、利率和年期的值计算贷款金额

private function calculateRepayment(_loanAmount, _years, _interest):Number
{
    var nWeek = _years * 52;
    var nInterest = _interest/(52*100);
    var nRepayment = ( _loanAmount * nInterest *Math.pow((1+nInterest),nWeek) ) / ( Math.pow((1+nInterest),nWeek)-1 );
    return Number(nRepayment);
}
关于转换为AS3或javascript的公式的任何帮助都将非常感谢,我认为理论上这是loanAmount=利率/利率时间

例如:


好的,我算出了,下面是函数:

private function calculateLoanAmount(_repayment, _years, _interest):Number
{
    var p:Number = _repayment; // weekly payment
    var i:Number = (_interest / 52) * 0.01; // weekly interest factor
    var n:Number = _years * 52; // number of weekly payments - (5 years) 5*52 = 260
    var principal:Number = (p * (1 - 1 / (Math.pow(1 + i, n)))) / i;
    principal = Math.round(roundDec(principal, 0)); // prepare for output
    return Number(principal);
}

这是我为一个朋友开发的一个flash贷款计算器。它应该是:var nRepayment=\u loanAmount*Math.pow1+nInterest,nWeek/nWeek;也就是说,我不确定这个贷款是如何运作的,在做作业时使用这个链接没有不正确的伪灰尘它应该是var nRepayment:Number=\u loanAmount*nInterest/1-Math.pow1/1+nInterest,nTerm;