(15C) Simple NPV
05-06-2017, 10:43 AM (This post was last modified: 05-06-2017 11:15 AM by Vtile.)
Post: #1
 Vtile Senior Member Posts: 384 Joined: Oct 2015
(15C) Simple NPV
As a happy owner of a miniature clone of 15C for a few days, I quickly searched a NPV functions for a HP15C yesterday, but didn't find any (or google optimisation didn't)! I made at the evening my own, it is my first RPN and 15C program so I assume it is not too sophisticated. Any improvement tips are welcome.

I quickly tested it and getting satisfactory results, but I can not claim to understand the financial calculations theory inside out so use the program at your own risk.

I did use HP12C formula given in the manual for the calculations.

NPV=(CL/(1+i)^0)+(CL/(1+i)^1)+...+(CL/(1+i)^n)

The program reads data from storage registers R1,R2,R3,R4, where
R1: n
R2: i% (in percentage)
R3: NPV (internal)
R4: CL (internal)

Starting conditions are stored in registers R1 and R2, while R3 and R4 are overwritten by program. Uses Label D.

Program assumes CL at the Y register, so when entering a value use [x<>y] or [Enter].

Program returns CL to Y register and NPV in X register. R1 can be recalled for n+1 value of the currently shown NPV.

For ie. 1st example in https://support.office.com/en-us/article...28acf2a568 can be calculated as follows.

0 STO 1
10 STO 2
0 ENTER f D (push the investment 1 year to the future as in example)
-10000 ENTER f D
3000 ENTER f D
4200 ENTER f D
6800 ENTER f D
Result: $1,188.4434 (FIX 4) Alternative route for the same example 1 STO 1 (push the investment 1 year to the future as in example) 10 STO 2 -10000 ENTER f D 3000 ENTER f D 4200 ENTER f D 6800 ENTER f D Result:$1,188.4434 (FIX 4)

http://h10032.www1.hp.com/ctg/Manual/c00363319.pdf
Page 60, NPV example.

f CLEAR REG
13 STO 2
-80000 Enter f D
-500 Enter f D
4500 Enter f D
5500 Enter f D
4500 Enter f D
130000 Enter f D
Result: 212.18

First version:
Code:
 001 LBL D 002 X<>Y 003 STO 4 004 RCL 1 005 g X=0 006 STO 3 007 R↓   008 1 009 RCL 2 010 g % 011 + 012 RCL 1 013 Y^X 014 / 015 STO+ 3 016 1 017 STO+ 1 018 RCL 4 019 RCL 3 020 RTN
As a future improvement I need to include an user mode switch somehow at the beginning of the program.
05-06-2017, 11:43 AM
Post: #2
 grsbanks Senior Member Posts: 977 Joined: Jan 2017
RE: (15C) Simple NPV
Nice one.

I'm assuming that, by a "miniature HP-15C clone" you mean a DM15, right?

You could provide a dump for people to simply load into the machine by following instructions here: http://www.swissmicros.com/nut_decoder

Disclaimer: I don't work for Swiss Micros but I had a hand in the writing of that decoder/encoder.
05-06-2017, 12:34 PM
Post: #3
 SlideRule Senior Member Posts: 1,022 Joined: Dec 2013
RE: (15C) Simple NPV
Tried NPV calculation on HP15 calculator for search engine, found the following url; Software for the HP15C; scroll down to find NPV coding ... enjoy.

BEST!
SlideRule
05-06-2017, 06:19 PM
Post: #4
 Vtile Senior Member Posts: 384 Joined: Oct 2015
RE: (15C) Simple NPV
@grbanks. Your guess is correct about the device, I'll look if I put it to download when this is a bit more mature.

@SlideRule. Hah, I have read that page many times in the past, but didn't remember it did have NPV & IRR routines. My search didn't give that to me with random search strings. The one in there seems to be pretty neat and how the IRR interpolation (Solver) is used, but I'm not a fan of the prefilled R1..R9 method I must say.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)