Function pv

  • Calculates the present value of an annuity investment based on constant-amount periodic payments and a constant interest rate.

    Parameters

    • rate: number

      Rate of interest (per period)

    • nper: number

      Number of compounding periods

    • pmt: number

      Payment

    • fv: number = 0

      Future value

    • when: PaymentDueTime = PaymentDueTime.End

      When payments are due

    Returns number

    the present value of a payment or investment

    Since

    v0.0.15

    Examples

    What is the present value (e.g., the initial investment) of an investment that needs to total $15692.93 after 10 years of saving $100 every month? Assume the interest rate is 5% (annually) compounded monthly.

    import { pv } from 'financial'

    pv(0.05/12, 10*12, -100, 15692.93) // -100.00067131625819

    By convention, the negative sign represents cash flow out (i.e., money not available today). Thus, to end up with $15,692.93 in 10 years saving $100 a month at 5% annual interest, one's initial deposit should also be $100.

    Notes

    The present value is computed by solving the equation:

    fv + pv * (1 + rate) ** nper + pmt * (1 + rate * when) / rate * ((1 + rate) ** nper - 1) = 0
    

    or, when rate = 0:

    fv + pv + pmt * nper = 0
    

    for pv, which is then returned.

    References

    Wheeler, D. A., E. Rathke, and R. Weir (Eds.) (2009, May).

Generated using TypeDoc