That formula only works if the initial rate (r) is a nominal rate. If you're starting with an effective rate, you don't have to divide it by the number of compounding periods (n) in a year and can just raise the accumulation factor to whatever power gets you to the time period you want.
The formula given for continuously compounding interest (force of interest) is correct if you have a constant force of interest. For a variable force of interest you need to divide a'(t)/a(t) and evaluate over the specific time period to get the correct compound interest.
You can also express compound interest as a function of the discount rate (d) depending if you are comparing to the value at the beginning or end of the compounding period.