static public double ipmt(double r, int per, int nper, double pv, double fv, int type) {double ipmt = fv(r, per - 1, pmt(r, nper, pv, fv, type), pv, type) * r;if (type==1) ipmt /= (1 + r);return ipmt;}

static public double IPMT(double r, int per, int nper, double pv, double fv, int type){double ipmt = FV(r, per - 1, PMT(r, nper, pv, fv, type), pv, type) * r;if (type == 1) ipmt /= (1 + r);return ipmt;}
