Post Reply 
Looking for TVM formulas
04-04-2014, 10:12 PM (This post was last modified: 04-04-2014 10:13 PM by Dave Britten.)
Post: #23
RE: Looking for TVM formulas
(04-04-2014 09:44 PM)Jeff_Kearns Wrote:  
(04-04-2014 02:07 PM)Dave Britten Wrote:  Program size is currently 478 steps, and I figure there will be another 150-200 when all that is implemented.

Wow! That is quite the program... Just FYI, the total program length (including Solver) for the HP-29C or HP-11C is 71 steps in length. Granted, it does poorly (if at all) at solving for interest. The program size for calculators with built-in solvers is substantially smaller (and finds solutions for periodic interest rates). What does your program do exactly? I thought you wanted a TVM solver.



TVM solver, mostly. The TI-95 has lots of RAM to work with, for a keystroke programmable calculator (about 8KB), and the default partitioning gives you about 1000 steps/bytes of work RAM to use for coding. Programs can be saved/loaded/executed from the file partition, which defaults to about 5KB (5000 steps or so). There are also instructions to save ranges of registers into the file memory for later retrieval. With default settings, you get 125 storage registers, all addressible directly or indirectly (any register can be used for indirection). I think it's also possible to shrink file space to zero, and rely on an 8/32 KB expansion module for your file storage, but you'd have to be working with some enormous programs to need that.

Off the top of my head, these are the routines in the program so far:

1. Main menu - Allows accessing the TVM menu, or selecting Begin/End modes. Amort will be accessible from here when I implement it.
2. TVM menu - Shows the 5 TVM variables, and allows storing a value into each, or requesting solutions. The 95 allows testing for the INV prefix key being used to modify a soft key, so each of the five soft key handlers checks for it, calls one of five "solve" routines if needed, then puts the display value into the selected variable.
3. Five "solve" routines - Three of these are direct solutions (PV, PMT, FV), and the other two prepare...
4. ...The numeric solver - A straight port of the HP 20S solver, with a couple changes specific to this progra. It chokes on overflows trying to solve for n or i% in the Susan example, so I probably ought to replace it. Works okay for 'typical' problems, but isn't particularly fast, as it's lacking any initial guess logic (just starts at 1).
5. ln(1+x) - Uses numeric methods discussed in this thread.
6. e^x - 1 - Ditto.
7. (1 + i%)^n - Uses the ln(1 + x) routine for greater accuracy. Needed by all of the solution equations.
8. ((1 + i%)^n) - 1 - Also uses e^x - 1, and again needed by the solutions.
9. i% Routine - Returns i% / 100 for calculations. Needs to have some of the repeat calls optimized away.
10. Begin/End Routine - Returns 1 or 0 if Begin or End is selected, respectively.
11. Solver equation - TVM equation with one side solved for zero, for use with numeric solver routine.

So, the (somewhat) redundant direct solutions, menu handlers, math utility routines, and included numeric solver explain the size. Also, the TI needs something like three bytes (steps) for goto, gosub, STO, RCL, comparison tests, and other instructions that require an argument, to allow for the full three or four digits used in the addresses. Any functions prefixed with INV will also use another byte for the prefix.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
Looking for TVM formulas - Dave Britten - 03-31-2014, 11:21 PM
RE: Looking for TVM formulas - Jeff_Kearns - 04-01-2014, 10:40 AM
RE: Looking for TVM formulas - Jeff_Kearns - 04-01-2014, 07:37 PM
RE: Looking for TVM formulas - Dieter - 04-02-2014, 12:21 PM
RE: Looking for TVM formulas - Dieter - 04-02-2014, 07:23 PM
RE: Looking for TVM formulas - Dieter - 04-06-2014, 07:46 PM
RE: Looking for TVM formulas - Dieter - 04-09-2014, 01:36 PM
RE: Looking for TVM formulas - Dieter - 04-02-2014, 07:40 PM
RE: Looking for TVM formulas - Dieter - 04-03-2014, 01:22 PM
RE: Looking for TVM formulas - Jeff_Kearns - 04-04-2014, 09:44 PM
RE: Looking for TVM formulas - Dave Britten - 04-04-2014 10:12 PM
RE: Looking for TVM formulas - Dieter - 04-05-2014, 09:58 PM

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