# HP Forums

You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Often the interest rate given is the nominal rate that compounds a given number of times in the year. I want a very quick way to calculate the annualised equivalent rate (AER) which is the same rate that compounds only once a year (often this is what banks quote as regulatory authorities mandate them to as the public understand 8.3% AER versus 8% APR compounded, say, monthly during the year. Also options and some other derivatives use the continuously compounded rate CCR (the asymptotic limit going from compounding once a year to monthly, to weekly, to daily, to hourly etc.). So the program will also calculate this also. I want to avoid using other registers, if possible, so it's a bit longer than necessary (e.g. the 100's being entered below!) as I don't want it to disturb a cashflow sequence entered into the calculator. {I'm intending to attempt the CFA exams and anything that adds to speed is a good :-) Can't figure out how to post smiley's to this! :-( }

The other permitted calculator (TI BA II Plus) has a sheet to do this but the HP12C will have significantly lower keystrokes as only have to input n (number of compounding periods per year) and i (the nominal rate) and then R/S. TI doesn't calculate the CCR on that sheet.

AER is output to X and CCR to Y.

For example (rounded to 2 decimal places):
i = 8% APR compounded monthly
AER = 8.30%
CCR = 8.33%

Let me know if you spot any problems in it.

Regards,

Joe

Code:
``` 01 1 02 RCL [i]     03 % 04 ENTER 05 e^x 06 x<>y 07 Rv 08 - 09 CHS 10 1 11 0 12 0 13 x 14 Rv 15 Rv 16 RCL [n] 17 / 18 1 19 + 20 RCL [n] 21 y^x 22 1 23 - 24 1 25 0 26 0 27 x 28 x<>y 29 Rv```
Hi Joe,

(06-11-2019 03:30 PM)Joe_H Wrote: [ -> ]Let me know if you spot any problems in it.

I don't see a problem with you program but I do see an opportunity to reduce the amount of programming lines in your code. You can replace the two 100's by pressing [ EEX ] 2. This will put a 100 in the X-Register using only 2 keystrokes.

(06-11-2019 03:30 PM)Joe_H Wrote: [ -> ]Can't figure out how to post smiley's to this! :-( }

You can type a smiley by pressing colon and right parentheses. Omit the hyphen. See .

Lastly, I see you are a new member here. So, welcome to the HP Museum!
Carsen,

Thanks for the welcome and the tips. I'm working on a few more programs coming (all finance related). Yes, the EEX 2 is a handy shortcut to save two memory locations. Wasn't sure if there is a maths trick to convert decimal to percentage.

Joe
An extract from:
Derivatives Demystified: A Step-by-Step Guide to Forwards, Futures, Swaps and Options, Second Edition By Andrew M. Chisholm © 2010 John Wiley & Sons, Ltd.

page 217
The … annual equivalent rate (AER) or the effective annual rate … measures the rate expressed with annual compounding that is equivalent to a rate expressed with interest compounded at more frequent intervals, such as twice a year. For example, a rate of 10% p.a. with semi-annual compounding is equivalent to 10.25% p.a. expressed with annual compounding (i.e. the AER is 10.25% p.a.).

page 218
AER formula
The formula for calculating the AER when interest is compounded m times per annum is as follows:
[attachment=7370]
For example, a nominal rate of 10% p.a. with semi-annual compounding is equivalent to 10.25% p.a. with annual compounding.
[attachment=7371]

BEST!
SlideRule
Sliderule

Yes your posts adds clarity for others coming here on what the difference is between AER (also called the effective rate) and APR (also called the nominal rate).

However, I'm going to change the program and split it into two separate programs: one for APR<->AER and one for i (either APR or AER) <-> CCR. The reason for this is that I thought about the AER/APR can go either way. For example, if we had an bank that compounded once a year at 5% and we wanted to compare it to a 90 day investment that returned 1.25%, we have to go back to the nominal rate (APR) so we need AER -> APR and not the other way round. In this case for AER of 5% APR is 4.91% and a quarterly interest would be 1.23% lower than the alternative investment.

Similarly, if the AER is given and we need the CCR for options pricing etc. it is also the opposite conversion.

In order to avoid using registers to store values (could mess up other cashflows in the calculator etc.) and to speed access to results for either of these programs X will be AER (assuming i=APR) and Y will be APR (assuming i=AER) for the periodically compounded program and in the CCR program X will be CCR (assuming i=APR) and Y will be CCR (assuming i=AER). I'll post them up here later today when I have them written and tested.

Joe
I have completed this program. Thinking about it further and to avoid confusion everything is in one program now with a selection option as there are effectively 3 options:

{using APR(nominal rate)=i, AER(effective rate)=i* and CCR(continuous comp. rate)=i**}

0 - i -> i* & i**
1 - i* -> i & i**
2 - i** -> i & i*

Option 2 is unlikely as I don't think it is often given that way but it completes the conversions there could be.

To use it put values into n and i and type 0, 1 or 2 followed by R/S. The output convention is that X will have the lowest * and Y the higher. Output is in percent form for convenience. It stores i in decimal form in R0 which also can be useful. R1 is also used.

Code:
``` 01 1                                /////// Interest Rate Conversion Program   uses n, i & X and 2 R registers ////// 02 RCL i                            // Convention APR=i, AER=i* & CCR=i** hence X=0,1 or 2 for selection referring to the *'s 03 %                                // Start by saving decimal i and 1 + decimal i as well as 100 (for percent conversion) 04 STO R0                            // store decimal i  05 + 06 STO R1                            // Store 1+decimal i 07 Rv                                // restore option to top of stack 08 x=0?                                // Start of select conversion option 09 g GTO 27             10 1 11 - 12 x=0? 13 g GTO 43                         14 RCL R1                            // Start CCR conversions: CCR -> APR & AER 15 LN() 16 ENTER 17 ENTER 18 RCL n 19 / 20 1 21 + 22 RCL n 23 y^x 24 1 25 - 26 g GTO 57                     27 RCL R0                        // Start APR conversions: APR -> CCR 28 ENTER 29 e^x 30 1 31 - 32 X/Y                            // APR -> AER 33 RCL n 34 / 35 1 36 + 37 RCL n 38 y^x 39 1                             40 -                             41 X/Y 42 g GTO 57                    // go to change format         43 RCL R1                        // Start AER Conversions AER -> APR & CCR 44 RCL n 45 1/x 46 y^x 47 1 48 - 49 RCL n 50 * 51 ENTER 52 ENTER 53 X/Y 54 e^x 55 1 56 - 57 EEX                    // routine to change to percent form - i* or i** is on top but will switch around as converts 58 2 59 * 60 X/Y 61 EEX 62 2 63 *```
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :