HP 34s: Three financial routines



#3

Hi,

I posted three financial routines for the HP 34s on the Articles section, to complement the existing TVM application :

- Cash flow analysis (corrected and improved by Dieter)

- Amortization

- Nominal / Effective interest rate conversion

As always, any suggestion is very welcome.

Regards,

Miguel

Edited: 12 Nov 2011, 7:43 p.m.


#4

Hi Miguel,

I am really glad to see you using the preprocessor extension to the WP 34S assembler! That is gratifying. Your code is an excellent example of usage of the extension.

A couple of points that will help in certain cases:

1) Most importantly, if you are using this tool (wp34s_pp or the -pp switch in wp34s_asm), it is better to let the tool assign the local label names (eg: LBL 01) and use a symbolic label for the target of your SLV or XEQ statement. (Just as a reminder, and not that you violated this, but the preprocessor cannot handle duplicate local labels [ie: LBL 01]. It is usually (always?!) better to let the tool choose local labels to use itself.)

2) For ease of input you can recode most of the text strings by using double quotes. The tool will parse it and figure out the most efficient coding required. Several things, like spaces, are automatically recoded as the '[space]' equivalent. In some cases, the double quote technique will produce fewer steps than you would have gotten otherwise. Regardless of whether the output steps are identical or not, it is certainly easier to code the strings using double quotes.

3) You have a few cases where your use stretched to the tool to places it was not intended to go :-) In at least one case, you made use of a GTO with a 'soft' label (step 16 of 'CFE', for example) where it had been my intention that this technique designed for use with the pseudo JMP instruction. In a way I am glad that the GTO actually worked in this case but I don't think it was never tested (at least not extensively)! In this example, if you had used a JMP instead GTO, the tool would have decided that this could have been coded with a SKIP instruction. These JMP->SKIP promotions will save a few steps here and there because the tool would not be forced to inject a LBL for the soft-targetted GTO.

I have attached a 'diff' output between your code and a slightly modified version to show you what I mean. The first line of each diff pair is the original line(s) from your code and the second line(s) are how I modified it. I can send you the modified code as a whole if you'd like. Just let me know.

Not that the resulting compression make too much difference, but your code assembled to 317 words in total (228 steps) and my variation assembled to 314 words (again, in 228 steps). This is mostly the loss of the additional LBLs (I think).

Keep up the fine work!

280c280
< [alpha]'CF'
---
> "CF"
282,283c282
< [alpha] [^]
< [alpha] n
---
> "[^]n"
287c286
< GTO endloop
---
> JMP endloop
311,312c310
< [alpha]'CF'
< [alpha] =
---
> "CF="
346c344
< [alpha]'CF'
---
> "CF"
348c346
< [alpha] =
---
> "="
396c394
< XEQ 00
---
> XEQ calcNPV_IRR
399,400c397
< [alpha]'NPV'
< [alpha] =
---
> "NPV="
435c432
< SLV 00
---
> SLV calcNPV_IRR
447,448c444
< [alpha]'IRR'
< [alpha] =
---
> "IRR="
454,455c450
< LBL 00 // Calculates NPV and solves for IRR
< 1
---
> calcNPV_IRR:: 1 // Calculates NPV and solves for IRR
468c463
< GTO intzero
---
> JMP intzero
527,528c522
< [alpha]'Cap'
< [alpha] ?
---
> "Cap?"
533,534c527
< [alpha]'Pmt'
< [alpha] ?
---
> "Pmt?"
539,540c532
< [alpha]'Tpr'
< [alpha]'ds?'
---
> "Tprds?"
548,549c540
< [alpha]'I/P'
< [alpha]'%?'
---
> "I/P%?"
588,589c579
< [alpha]'Prd'
< [alpha]'-I?'
---
> "Prd-I?"
595,596c585
< [alpha]'Prd'
< [alpha]'-F?'
---
> "Prd-F?"
611c600
< [alpha]'Pri'
---
> "Pri"
616c605
< [alpha]'Int'
---
> "Int"
621c610
< [alpha]'Bal'
---
> "Bal"
701,702c690
< [alpha]'P-Y'
< [alpha] ?
---
> "P-Y?"
733c721
< XEQ 01
---
> XEQ calcEFF_NOM
739,740c727
< LBL 01 // Calculates EFF and solves for NOM
< RCL D
---
> calcEFF_NOM:: RCL D // Calculates EFF and solves for NOM


#5

Thank you Neil for your comments, I will make the necessary changes to incorporate them in my code and post an edited version.

Have a nice evening,

Miguel

#6

...And done!


Possibly Related Threads…
Thread Author Replies Views Last Post
  10bii Financial Calculator is on launch sale - 0.99$ only John 4 2,061 11-10-2013, 08:02 PM
Last Post: BShoring
  HP-80 Financial Calculator (1973) BShoring 3 1,734 03-25-2013, 11:39 PM
Last Post: BShoring
  Simple financial problem with a HP-12c Platinum Lapin 3 1,651 11-11-2012, 09:33 AM
Last Post: Lapin
  HP financial calculator prototypes Keith Midson 4 1,759 10-06-2012, 03:13 PM
Last Post: Harald
  Financial Calculations for the HP41: another enhanced version Luiz C. Vieira (Brazil) 0 855 04-16-2012, 09:16 AM
Last Post: Luiz C. Vieira (Brazil)
  HP-41CX and Financial Decisions Module Cheyenne Whitley 22 5,524 04-07-2012, 07:51 PM
Last Post: Garth Wilson
  HP-35A/21 D.MS<-->Decimal degrees routines Matt Agajanian 9 2,998 03-29-2012, 11:03 AM
Last Post: Matt Agajanian
  accuracy of integration and solve routines HP 15C LE Jan 3 1,438 02-02-2012, 01:03 PM
Last Post: Marcus von Cube, Germany
  [WP34s] XROM routines fhub 32 7,831 01-10-2012, 04:28 AM
Last Post: Marcus von Cube, Germany
  [wp 34s] wp 34s picture and scan Jeroen Van Nieuwenhove 2 1,201 10-27-2011, 09:02 PM
Last Post: Les Wright

Forum Jump: