[−][src]Function finance_solution::convert_ear_to_epr
pub fn convert_ear_to_epr(ear: f64, compounding_periods_in_year: u32) -> f64
Convert an EAR (Effective Annual Rate) to periodic rate (aka EPR, effective periodic rate). Returns f64.
Related Functions:
convert_ear_to_epr_solution
to convert EAR to EPR and return a custom type with extra information available in the dbg!().
The formula is:
or this formula can be re-written as:
Arguments
ear
- The input rate (effective annual rate), expressed as a floating point number. For instance 0.05 would mean 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 effective annual rate to periodic rate.
use finance_solution::*; // The effective annual rate is 3.4534%. // There are 12 compounding periods per year. let effective_annual_rate = 0.03453486936; let periods = 12; let periodic_rate = convert_rate::convert_ear_to_epr(effective_annual_rate, periods); // Confirm that the EPR is correct. assert_approx_equal!(0.00283333, periodic_rate);