Function financial::pv

source ·
pub fn pv(
    rate: f64,
    nper: f64,
    pmt: Option<f64>,
    fv: Option<f64>,
    pmt_at_begining: Option<bool>
) -> f64
Expand description

Calculates the present value of a loan or an investment, based on a constant interest rate. You can use PV with either periodic, constant payments (such as a mortgage or other loan), or a future value that’s your investment goal.

Examples

let fv = financial::fv(0.1, 5.0, Some(100.0), Some(1000.0), Some(false));
assert_eq!(fv, -2221.020000000001);