Expand description
Present value annuity calculations. Given a series of cashflows, a number of periods such as years, and fixed or varying interest rates, what is the current value of the series of cashflows (annuity) right now?
For most common usages, we recommend the present_value_annuity_solution function, which provides a better debugging experience and additional features.
§Example
let (rate, periods, annuity, due) = (0.034, 10, 500, false);
let pv_ann = present_value_annuity_solution(rate, periods, annuity, due);
dbg!(pv_ann);Outputs to terminal:
{
calculated_field: PresentValueAnnuity,
rate: 0.034,
periods: 10,
present_value: -4179.341028819192,
future_value: -5838.660162934531,
due_at_beginning: false,
payment: 500.0,
sum_of_payments: 5000.0,
sum_of_interest: -5018.001191753723,
formula: "-500 * ((1. - (1. / (1. + 0.034)).powf(10)) / 0.034) * (1 + (0.034 * 0));",
symbolic_formula: "-annuity * ((1. - (1. / (1. + rate)).powf(periods)) / rate) * (1. + (rate * due));",
}Functions§
- present_
value_ annuity - Returns the present value of an annuity (series of constant cashflows) at a constant rate. Returns f64.
- present_
value_ annuity_ accumulator - present_
value_ annuity_ solution - Returns the present value of a future series of constant cashflows and constant rate. Returns custom solution type with additional information and functionality.