здесь, в моей версии PMT
PMT: function(rate, nperiod, pv, fv, type) {
if (!fv) fv = 0;
if (!type) type = 0;
if (rate == 0) return -(pv + fv)/nperiod;
var pvif = Math.pow(1 + rate, nperiod);
var pmt = rate / (pvif - 1) * -(pv * pvif + fv);
if (type == 1) {
pmt /= (1 + rate);
};
return pmt;
},
//// Позвоните в ГУП
var result = PMT(6.5/1200 , 30*12 , 65000 , 0 , 0);
console.log(result);
//// result : -410.8442152704279
/// Другие, а также IPMT и PPMT
IPMT: function(pv, pmt, rate, per) {
var tmp = Math.pow(1 + rate, per);
return 0 - (pv * tmp * rate + pmt * (tmp - 1));
},
PPMT: function(rate, per, nper, pv, fv, type) {
if (per < 1 || (per >= nper + 1)) return null;
var pmt = this.PMT(rate, nper, pv, fv, type);
var ipmt = this.IPMT(pv, pmt, rate, per - 1);
return pmt - ipmt;
},