等额本息计算方式



- (void)calculateEquivalentPrincipalWithYear: (NSInteger)year borrow: (NSInteger)borrow rate: (double)rate {
    int months = year*12.f;
    double rest = borrow * 10000.f;
    double interestRate = rate/100/12;
    double perMonthPrincipal = rest/(months*1.f);
    for (int i=months; i>0; i--) {
        double interest = rest*interestRate;
        rest = rest-perMonthPrincipal;
        iceLog(@">>> No.%d need:%f, interest:%f, rest:%f",months-i+1, perMonthPrincipal, interest, rest);
    }
}

你可能感兴趣的:(等额本息计算方式)