Skip to main content

ppmt

Function ppmt 

Source
pub fn ppmt<P, F, T>(
    rate: f64,
    period: u32,
    periods: u32,
    present_value: P,
    future_value: F,
    timing: T,
) -> FinanceResult<f64>
where P: Into<f64> + Copy, F: Into<f64> + Copy, T: Into<PaymentTiming>,
Expand description

Principal portion of the payment for a single period (Excel PPMT).

§Errors

Same domain as ipmt.

§Examples

use finance_solution::*;
let principal = ppmt(0.01, 1, 12, 10_000.0, 0.0, false).unwrap();
let interest = ipmt(0.01, 1, 12, 10_000.0, 0.0, false).unwrap();
let pmt = payment(0.01, 12, 10_000.0, 0.0, false).unwrap();
assert_approx_equal!(principal + interest, pmt);