Function compoundInterest

  • Calculate the compound interest earned on a principal over time.

    Parameters

    • P: number

      The principal. (P>0)

    • r: number

      The interest rate. (0≤r≤1)

    • n: number

      The number of times compounded per period. (n is an integer and n>0)

    • t: number

      The number of periods. (t is an integer and t>0)

    Returns {
        A: number;
        I: number;
    }

    Returns an object with the accrued amount and interest earned.

    • A: number
    • I: number

    Since

    0.4.2