# PERIODS()

Number of periods for a loan

Syntax

  PERIODS (nLoan, nPayment, nInterest) --> nPeriods

Arguments

  <nLoan> amount of money you get from the bank <nPayment> amount of money you pay back per period <nInterest> rate of interest per period, 1 == 100%

Returns

  <nPeriods> number of periods you need to pay the loan back

Description

  PERIODS() calculates the number of periods one needs to pay back a loan of <nLoan> with periodical payments of <nPayment> and for a rate of interest <nInterest> per period. debt in period 0 = <nLoan> debt in period 1 = ((debt in period 0)-<nPayment>)*(1+<nInterest>/100) debt in period 2 = ((debt in period 1)-<nPayment>)*(1+<nInterest>/100) etc... debt in period <nPeriod> = ((debt in period <nPeriod>-1)-<nPayment>)*(1+<nInterest>/100) -> has to be 0, so <nPeriods> = -log(1-<nLoan>*(<nInterest>/100)/<nPayment>)/log(1+<nInterest>/100))
  Note, however that in the case of nPayment <= <nLoan>*(<nInterest>/100), one would need infinite time to pay the loan back. The functions does then return -1.

Examples

          // You get a loan of 5172.56 at a interest rate of 0.5% per
          // month (6% per year).
          // You can afford to pay 100 back every month, so you need

          ? periods (5172.56, 100, 0.005)  --> 60.0

          // months to cancel the loan.
    Tests
          periods (5172.56, 100, 0.005) == 60.0
          periods (5172.56, 100, 0.0) == 51.7256

Status

  Ready

Compliance

  PERIODS() is compatible with CT3's PERIODS().

Platforms

  All

Files

  Source is finan.c, library is libct.

See Also

- PV()
- FV()
- PAYMENT()
- RATE()