[][src]Function finance_solution::future_value_annuity::future_value_annuity_solution

pub fn future_value_annuity_solution<T>(
    rate: f64,
    periods: u32,
    cashflow: T,
    due_at_beginning: bool
) -> CashflowSolution where
    T: Into<f64> + Copy

Returns the future value of annuity (a series of constant cashflows) at a constant rate. Returns custom solution struct with additional information and functionality.

Related functions:

  • To calculate a future value returning an f64, use [present_value_annuity].
  • To calculate a future value with a varying rate or varying cashflow or both, use [present_value_annuity_schedule].

The future value annuity formula is:

future value ann = sum( cashflow * (1 + rate)period ) or future value ann = Constant_Cashflow * ((1+periodic_rate)^n -1) / periodic_rate

Arguments

  • rate - The rate at which the investment grows or shrinks per period, expressed as a floating point number. For instance 0.05 would mean 5%. Often appears as r or i in formulas.
  • periods - The number of periods such as quarters or years. Often appears as n or t.
  • cashflow - The value of the constant cashflow (aka payment).
  • due_at_beginning - True if the payment is due at the beginning of the period. Typically the payment will be due at the end of the period so this will be false.

Examples

Future value of a $500 annuity (a series of $500 cashflows) at 3.4% for 10 years.

use finance_solution::*;
let (rate, periods, cashflow, due_at_beginning) = (0.034, 10, 500, false);
let my_annuity = future_value_annuity_solution(rate, periods, cashflow, due_at_beginning);
dbg!(&my_annuity);