--- title: "Financial Calculations" id: 71769 type: "computer_media" slug: "financial-calculations" url: "http://localhost/computer_media/financial-calculations/" markdown_url: "http://localhost/computer_media/financial-calculations.md" published_at: "2026-10-05T22:36:23+00:00" modified_at: "2026-10-05T22:36:41+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/10/Financial-Calculations.png" excerpt: "A ten-module financial calculator covering compound interest, loan payments, and savings goals, with a clever one-line menu dispatch that jumps directly to each module." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Dick Wagner" slug: "dick-wagner" taxonomy: "indiv" url: "http://localhost/indiv/dick-wagner/" genre: - name: "Finance" slug: "finance" taxonomy: "genre" url: "http://localhost/type/finance/" media_type: "Program" programmers: - name: "Dick Wagner" slug: "dick-wagner" taxonomy: "indiv" url: "http://localhost/indiv/dick-wagner/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Financial%20Calculations%20(198x)(Wagner%2C%20Dick)(TS2068)(US)(Program).zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2026/10/Financial-Calculations.png" article_media: - id: 43417 title: "Financial Program" type: "article" url: "http://localhost/article/financial-program/" media_type_tags: "Finance" --- # Financial Calculations This program implements a ten-module financial calculator covering compound interest, loan payments, savings projections, and sinking funds. Menu selection uses the arithmetic expression `X*100+10+100*(X>9)` to dispatch directly to the appropriate module’s starting line, avoiding a chain of IF statements. Each module accepts inputs, applies standard time-value-of-money formulas using LN and exponentiation, then rounds results to two decimal places using the `INT(V*100+.5)/100` idiom before displaying dollar amounts. The program self-restarts with `PAUSE 0:RUN` after each calculation, returning the user to the main menu. Module 8 computes both the remaining loan balance and accumulated interest over a block of payment periods using closed-form amortization formulas. *** ### Program Structure The program is organized as a menu driver (lines 10–80) followed by ten self-contained calculation modules, each occupying a dedicated line-number block: | Module # | Starting Line | Topic | | --- | --- | --- | | 1 | 110 | Compound interest (future value of lump sum) | | 2 | 210 | Time to reach a desired compound amount | | 3 | 310 | Rate of return | | 4 | 410 | Future value of periodic payments | | 5 | 510 | Monthly payment to reach a desired amount | | 6 | 610 | Number of payments for a financed amount | | 7 | 710 | Monthly loan payment | | 8 | 810 | Loan balance and accumulated interest over a payment block | | 9 | 1010 | Affordable loan amount | | 10 | 1110 | Sinking fund yearly deposit | Line 3 immediately redirects to line 17, bypassing the introductory screen on subsequent `RUN` restarts, while line 5 holds a descriptive REM comment that also serves as documentation for the combined-module design. ### Menu Dispatch Technique Line 75 is the most technically interesting line in the program: `75 GO TO X*100+10+100*(X>9)` For choices 1–9, the Boolean expression `(X>9)` evaluates to 0, so the target is `X*100+10` (e.g., X=1 → line 110, X=7 → line 710). For X=10, the expression adds an extra 100, giving `10*100+10+100 = 1110`, which correctly targets the Sinking Fund module. This single arithmetic expression replaces ten separate `IF/GO TO` statements. Line 74 range-checks the input before the dispatch, rejecting values below 1 or above 11. ### Financial Formulas All modules implement standard time-value-of-money formulas. Notable implementations include: - **Module 1**: `V = A*(1+I/TY)^(TY*T)` — standard compound interest. - **Module 2**: `T = LN(V/A) / (LN(1+I/TY)*TY)` — solving for time using natural logarithm. - **Module 3**: `I = ((V/A)^(1/(TY*T))-1)*TY` — solving for periodic rate then annualizing. - **Module 6**: `N = LN(A/(A-P*I)) / LN(1+I)` — number of payments via logarithm. - **Module 8**: Two closed-form amortization expressions compute both remaining balance at payment `Y` and accumulated interest between payments `X` and `Y`. - **Module 9**: `P = A*(1-(1+I)^-N)/I` — present value of an annuity. ### Interest Rate Input Convention Modules differ in how they convert the user-entered percentage to a decimal rate. Modules 1–3 and 10 divide by 100 (annual rate). Modules 4–9 divide by 1200, converting an annual percentage to a monthly decimal rate in one step. This is appropriate since those modules work in monthly periods, but it means the user must always enter the annual percentage regardless of module. ### Rounding and Output Dollar amounts are consistently rounded to two decimal places using the idiom `INT(V*100+.5)/100`, which adds half a cent before truncating. This is a standard technique for avoiding display of floating-point noise without using string formatting functions. Results are prefixed with a literal `"$"` string in PRINT statements. ### Control Flow and Restart Every module ends with `PAUSE 0:RUN`, which waits for a keypress then restarts the entire program. Because line 3 redirects to line 17 (the CLS before the menu), repeated use stays at the menu rather than replaying the introductory screen. Line 9996 (`RUN`) and line 3800 (`PAUSE 0:RUN`) appear to be remnants or safety catches in the line-number space. ### Bugs and Anomalies - **Module 5 formula error**: Line 550 computes `A = (FV*I)/((1-I)^(T+1)-(1+I))`. The denominator should be `((1+I)^(T+1)-(1+I))` to correctly derive the periodic payment from a future value annuity. Using `(1-I)` instead of `(1+I)` will produce incorrect results for any positive interest rate. - **Module 7 double division**: Line 750 computes `I/12` after `I` has already been divided by 1200 at line 730, effectively dividing by 14400 instead of 1200. This will produce a very small payment amount. - **REM comment typo**: Line 500 has `REM PATMENTFOR AMOUNT` — “PATMENT” instead of “PAYMENT”, and missing a space. - **REM comment typo**: Line 800 has `REM LOAD BALANCE` — “LOAD” instead of “LOAN”. - **Module 8 balance formula**: Line 860 uses `1/((I+1)^-Y)` which equals `(1+I)^Y`, a standard amortization term, so this is mathematically correct despite the indirect notation. ## Source Code ``` 3 GO TO 17 5 CLS :REM PLOTTER V9 N11 \{20}\{1} BY DICK WAGNER. MODULES ARE PROGRAMS FROM THE BOOK "80 PRACTICAL TIME SAVING PROGRAMS FOR THE TRS-80" BY CHARLES J. CARROLL. SOME HAVE BEEN MODIFIED AND THE SINGLE PROGRAM HAS BEEN MADE TO COMBINE THE MODULES. \{20}\{0} 10 PRINT AT 3,0;"FINANCIAL CALCULATIONS FOR : LOANS, SAVINGS, AND COMPOUND INTEREST"'' 15 PRINT AT 9,0;"VARIABLES ARE: INITIAL DEPOSIT (A) INTEREST RATE (I) FUTURE VALUE (V) NUMBER OF YEARS (T) NUMBER OF TIMES/YEAR PRINCIPLE IS COMPOUNDED (TY)" 16 PAUSE 0 17 CLS 20 PRINT " 1 COMPOUND INTEREST" 25 PRINT '" 2 COMPOUND INTEREST TO ACHIEVE DESIRED AMOUNT" 30 PRINT '" 3 RATE OF RETURN IN % PER YEAR" 35 PRINT '" 4 FUTURE VALUE" 40 PRINT '" 5 MONTHLY PAYMENT TO OBTAIN DESIRED AMOUNT" 45 PRINT '" 6 MONTHLY PAYMENTS FOR AMOUNT TO BE FINANCED" 50 PRINT '" 7 MONTHLY LOAN PAYMENT" 55 PRINT '" 8 LOAN BALANCE AT END OF ANY BLOCK OF PAYMENT PERIODS" 60 PRINT '" 9 AFFORDABLE LOAN AMOUNT" 65 PRINT '"10 SINKING FUND" 70 INPUT "FINANCIAL CALCULATION DESIRED? ";X 72 IF X=0 THEN GO TO 9998 73 IF X=11 THEN GO TO 9990 74 IF X<1 OR X>11 THEN GO TO 10 75 GO TO X*100+10+100*(X>9) 80 STOP 100 REM \{20}\{1}COMPOUND INTEREST\{20}\{0} 110 CLS 120 INPUT "AMOUNT TO BE COMPOUNDED? ";A 130 INPUT "INTEREST RATE IN %? ";I:LET I=I/100 140 INPUT "NUMBER OF YEARS MONEY IS TO COMPOUND? ";T 150 INPUT "NUMBER OF COMPOUND PERIODS/YEAR? ";TY 160 LET V=A*(1+I/TY)^(TY*T) 170 PRINT "$"; INT (V*100+.5)/100;" COMPOUND INTEREST FOR ";T;" YEARS" 180 PAUSE 0:RUN 200 REM \{20}\{1}COMPOUND INTEREST\{20}\{0} 210 CLS 220 INPUT "AMOUNT TO BE COMPOUNDED? ";A 230 INPUT "INTEREST RATE? ";I:LET I=I/100 240 INPUT "FINAL DESIRED AMOUNT? ";V 250 INPUT "NUMBER OF COMPOUND PERIODS/YEAR? ";TY 260 LET T= LN (V/A)/(LN (1+I/TY)*TY) 270 PRINT "COMPOUND ";TY;" TIMES PER YEAR WILL REQUIRE THE MONEY TO BE DEPOSITED "; INT (T*10+.5)/10;" YEARS" 280 PAUSE 0:RUN 300 REM \{20}\{1}RATE OF RETURN\{20}\{0} 310 CLS 320 INPUT "AMOUNT TO BE COMPOUNDED? ";A 330 INPUT "FINAL AMOUNT? ";V 340 INPUT "NUMBER OF YEARS MONEY IS TO COMPOUND? ";T 350 INPUT "NUMBER OF COMPOUND PERIODS/YEAR? ";TY 360 LET I=((V/A)^(1/(TY*T))-1)*TY 370 PRINT "RATE OF RETURN IS ";I*100;"% PER YEAR" 380 PAUSE 0:RUN 400 REM \{20}\{1}FUTURE VALUE\{20}\{0} 410 CLS 420 INPUT "AMOUNT OF MONTHLY PAYMENT? ";A 430 INPUT "INTEREST RATE IN %? ";I:LET I=I/1200 440 INPUT "NUMBER OF YEARS? ";T:LET T=T*12 450 LET FV=A/I*((1+I)^(T+1)-(1+I)) 460 PRINT "$"; INT (FV*100+.5)/100 470 PAUSE 0:RUN 500 REM \{20}\{1}PATMENTFOR AMOUNT\{20}\{0} 510 CLS 520 INPUT "FINAL DESIRED AMOUNT? ";FV 530 INPUT "INTEREST RATE IN %? ";I:LET I=I/1200 540 INPUT "NUMBER OF YEARS? ";T:LET T=T*12 550 LET A=(FV*I)/((1-I)^(T+1)-(1+I)) 560 PRINT "$"; INT (A*100+.5)/100;" MONTHLY PAYMENTS" 570 PAUSE 0:RUN 600 REM \{20}\{1}NUMBER OF PAYMENTS\{20}\{0} 610 CLS 620 INPUT "AMOUNT TO BE FINANCED? ";P 630 INPUT "INTEREST RATE IN %? ";I:LET I=I/1200 640 INPUT "AMOUNT OF AFFORDABLE MONTHLY PAYMENT? ";A 650 LET N= LN (A/(A-P*I))/ LN (1+I) 660 PRINT N;" MONTHLY PAYMENTS" 670 PAUSE 0:RUN 700 REM \{20}\{1}MONTHLY LOAN PAYMENT\{20}\{0} 710 CLS 720 INPUT "AMOUNT TO BE FINANCED? ";P 730 INPUT "INTEREST RATE IN %? ";I:LET I=I/1200 740 INPUT "NUMBER OF YEARS OF FINANCING? ";N:LET N=N*12 750 LET A=P*(I/12)/(1-(1+I/12)^-N) 760 PRINT "MONTHLY PAYMENT IS $"; INT (A*100+.5)/100 770 PAUSE 0:RUN 800 REM \{20}\{1}LOAD BALANCE\{20}\{0} 810 CLS :INPUT "AMOUNT TO BE FINANCED? ";P 820 INPUT "INTEREST RATE IN %? ";I:LET I=I/1200 830 INPUT "MONTHLY PAYMENT? ";A 840 INPUT "BEGINNING PAYMENT NUMBER? ";X 850 INPUT "ENDING PAYMENT NUMBER? ";Y 860 LET B=1/((I+1)^-Y)*((A*(((1+I)^-Y)-1))/I+P) 870 PRINT "BALANCE AT THE END OF PAYMENT NUMBER ";Y;"--$"; INT (B*100+.5)/100 880 LET AI=B-(1/((I+1)^-(X-1))*((A*(((1+I)^-(X-1))-1))/I+P))+(Y-X+1)*A 890 PRINT "ACCUMULATED INTEREST AT THE END OF PAYMENT NUMBER ";Y;"--$"; INT (AI*100+.5)/100 895 PAUSE 0:RUN 1000 REM \{20}\{1}LOAN AMOUNT\{20}\{0} 1005 CLS 1010 INPUT "NUMBER OF PAYMENTS DESIRED? ";N 1020 INPUT "INTEREST RATE IN %? ";I:LET I=I/1200 1030 INPUT "AMOUNT MONTHLY PAYMENT? ";A 1040 LET P=A*(1-(1+I)^-N)/I 1050 PRINT "YOU CAN AFFORD TO BORROW $";P 1060 PAUSE 0:RUN 1100 REM \{20}\{1}SINKING FUND\{20}\{0} 1110 CLS 1120 INPUT "AMOUNT TO BE ACCUMULATED? ";P 1130 INPUT "INTEREST RATE IN %? ";I:LET I=I/100 1140 INPUT "NUMBER OF YEARS OF ACCUMULATION? ";N 1150 LET A=P*I/(((1+I)^N)-1) 1160 PRINT "YEARLY DEPOSIT IS $"; INT (A*100+.5)/100 1170 PAUSE 0:RUN 3800 PAUSE 0:RUN 9989 STOP 9992 REM RANDOMIZE USR 100:SAVE "FNANCL.B1" LINE 5 9996 RUN 9998 REM RANDOMIZE USR 100:LOAD "L.B1" ```