[−][src]Function finance_solution::convert_apr_to_epr_solution
pub fn convert_apr_to_epr_solution(
apr: f64,
compounding_periods_in_year: u32
) -> ConvertRateSolution
Convert APR (annual rate) to periodic rate. Returns a custom solution type.
Related Functions:
apr
macro to convert APR to all forms of rate conversion, and return a custom type with additional functionality and extra information available in the dbg!().convert_apr_to_epr
to convert APR to EPR and return a single f64 value instead of a solution struct.
The formula:
Arguments
rate
- The input rate, expressed as a floating point number. For instance 0.05 would mean 5%. Often appears asr
ori
in formulas.compounding_periods_in_year
- The number of compounding periods in a year. Often appears asn
ort
.
Panics
compounding_periods_in_year
- must be a u32 value greater than 0.
Example
Convert annual rate to periodic rate.
use finance_solution::*; // The annual percentage rate is 3.4%. // There are 12 compounding periods per year. let nominal_rate = 0.034; let periods = 12; let apr_to_epr_solution = convert_apr_to_epr_solution(nominal_rate, periods); // Confirm that the periodic rate is correct to six decimal places. assert_approx_equal!(0.00283333, apr_to_epr_solution.epr());