0
以下是我的函数来计算贷款支付, 就像在Excel中我需要添加另一个参数,这是付款类型。PMT功能付款方式
function PMT (ir, np, pv, fv) {
/*
ir - interest rate per month
np - number of periods (months)
pv - present value
fv - future value (residual value)
type - 0 or 1 need to implement that
*/
pmt = (ir * (pv * Math.pow ((ir+1), np) + fv))/((ir + 1) * (Math.pow ((ir+1), np) -1));
return pmt;
}
随着类型= 0,兴趣计算1个月,因为付款被假定为在一个月的末尾。对于类型= 1,利息计算为0个月,因为付款是在月初。
任何人都可以帮助我用这个PaymentType功能修改上述功能。
http://www.techonthenet.com/excel/formulas/pmt.php
在此先感谢
这是javascript代码,对吧?如果是这样,请删除除javascript外的所有标签。另外,你真正的问题是什么。 – 2011-03-18 13:08:40
如果这是.Net,则有一种方法(Financial.Pmt)可以为您计算付款。其中一个论点是如何申请兴趣(开始或结束)。 – dbasnett 2011-03-18 23:41:19