[−][src]Function finance_solution::convert_apr_to_ear
pub fn convert_apr_to_ear(apr: f64, compounding_periods_in_year: u32) -> f64
Convert a nominal interest rate (Annual rate, APR) to EAR (effective annual rate). Returns f64.
Related Functions:
apr
to convert APR to all forms of rate conversion, and return a custom type with additional functionality and extra information available in thedbg!()
.convert_apr_to_ear_solution
to convert APR to EAR and return a custom type with additional functionality and extra information available in thedbg!()
.
The formula:
Arguments
rate
- The input 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
. Must be u32.
Panics
periods
- must be a u32 value greater than 0.
Examples
Convert annual rate to effective annual rate.
use finance_solution::*; // The annual percentage rate is 3.4% and 12 compounding periods per year. let nominal_rate = 0.034; let periods = 12; let effective_annual_rate = convert_rate::convert_apr_to_ear(nominal_rate, periods); // Confirm that the EAR is correct. assert_approx_equal!(0.034535, effective_annual_rate);