[−][src]Function finance_solution::convert_epr_to_apr_solution
pub fn convert_epr_to_apr_solution(
epr: f64,
compounding_periods_in_year: u32
) -> ConvertRateSolution
Convert periodic rate to APR (aka Annual rate, nominal interest rate, Annual Percentage Rate). Returns a custom solution type.
Related Functions:
convert_epr_to_apr
to convert EPR to APR and return an f64 instead of a full solution struct.
The formula is:
Arguments
epr
- The input rate (periodic rate), expressed as a floating point number. For instance 0.05 indicates 5%. Often appears asr
ori
in formulas.periods
- The number of compounding periods in a year. Often appears asn
ort
.
Panics
periods
- must be a u32 value greater than or equal to 1.
Example
Convert a periodic rate to the annual rate (APR).
use finance_solution::*; // The periodic rate is 3.4%. There are 12 compounding periods per year. let (periodic_rate, periods) = (0.034, 12); let epr_to_apr_solution = convert_rate::convert_epr_to_apr_solution(periodic_rate, periods); // Confirm that the APR is correct. assert_approx_equal!(0.4080, epr_to_apr_solution.apr());