[−][src]Function finance_solution::convert_apr_to_epr
pub fn convert_apr_to_epr(apr: f64, compounding_periods_in_year: u32) -> f64
Convert APR (annual rate) to periodic rate. Returns f64.
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_solution
to convert APR to EPR and return a custom type with additional functionality and extra information available in the dbg!().
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 periodic_rate = convert_apr_to_epr(nominal_rate, periods); // Confirm that the periodic value is correct to six decimal places. assert_approx_equal!(0.00283333, periodic_rate);