PC-1211, PC-1250, etc. TVM
03-30-2021, 04:58 PM
Post: #1
 Dave Britten Senior Member Posts: 2,251 Joined: Dec 2013
PC-1211, PC-1250, etc. TVM
In light of all the recent Sharp enthusiasm, here's my attempt at a TVM solver for the PC-1211, and compatible models like the PC-1250, and no doubt many others (and their corresponding Tandy/Radio Shack versions).

The math is based largely on the 17BII manual's formulas, this TVM program for serveral different HPs, and some of the mathematical notes found here.

The PC-1211 and PC-1250 don't have hyperbolic functions for easy, accurate calculation of e^x-1 for |x| close to zero, but using the infinite series for ln(1+x) does offer some accuracy improvement.

Usage is fairly straight-forward. On the PC-1211, you'll need to switch to DEF mode. On other models like the PC-1250, there's a dedicated DEF key that you press instead of Shift. Set B=1 for begin mode, otherwise set B=0. These are the key assignments - for storing variables, first enter the value into the display, then press the appropriate key:

Shift Z: Store n
Shift X: Store i%
Shift C: Store PV
Shift V: Store PMT
Shift B: Store FV

Shift A: Compute n
Shift S: Compute i%
Shift D: Compute PV
Shift F: Compute PMT
Shift G: Compute FV

Code:
2 PRINT "N=";N:END
4 PRINT "I%=";I:END
6 PRINT "PV=";P:END
8 PRINT "PMT=";M:END
10 PRINT "FV=";F:END
11 "A":GOSUB 100:N=LN ((MK/J-F)/(MK/J+P))/LN (1+J):GOTO2
21 "S":IF I=0LET I=.01
22 GOSUB 28:IF Y=0GOTO 4
23 V=I:I=I+.01:GOSUB 28
24 T=I:I=I-(I-V)Y/(Y-W):V=T:GOSUB 28
25 IF (Y<>0)*(Y<>W)GOTO 24
26 GOTO 4
28 W=Y:GOSUB 100:Y=P+KMU+FS:RETURN
31 "D":GOSUB 100:P=-KMU-FS:GOTO 6
41 "F":GOSUB 100:M=(-FS-P)/K/U:GOTO 8
51 "G":GOSUB 100:F=-(MKU+P)/S:GOTO 10
100 J=.01I:S=(1+J)^-N:U=(1-S)/J:K=1+JB:RETURN

Alternative lines for greater accuracy at the cost of speed:
100 J=.01I:IF ABS J>=1 LET L=LN (1+J):GOTO 105
101 S=J:C=2:X=-J:Z=X
102 Z=Z*X:L=S-Z/C:IF L=S GOTO 105
103 C=C+1:S=L:GOTO 102
105 S=1/EXP (NL):U=(1-S)/J:K=1+JB:RETURN

Results are generally pretty good, and don't seem to differ by more than a few thousandths of a penny in the few sample problems that I tried. I'm not sure if the Sharps use binary rather than decimal, but I did notice that solving for PMT in a problem where FV=0, then immediately solving for FV could yield small non-zero values on the order of 1E-5.
03-30-2021, 05:07 PM
Post: #2
 robve Senior Member Posts: 398 Joined: Sep 2020
RE: PC-1211, PC-1250, etc. TVM
Thanks for sharing!

(03-30-2021 04:58 PM)Dave Britten Wrote:  I'm not sure if the Sharps use binary rather than decimal, but I did notice that solving for PMT in a problem where FV=0, then immediately solving for FV could yield small non-zero values on the order of 1E-5.

FYI. SHARP pocket computers use 10 digits BCD to display values and store values in variables and 12 digits internally to evaluate expressions.

For example (SQR is sqrt):

SQR 2 * SQR 2
2

X=SQR 2
X*X
1.999999999

There is a small penalty to use variables to store (temporary) results. It is sometimes beneficial to "inline" expressions to preserve or increase accuracy.

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
04-01-2021, 04:44 PM
Post: #3
 Dave Britten Senior Member Posts: 2,251 Joined: Dec 2013
RE: PC-1211, PC-1250, etc. TVM
(03-30-2021 05:07 PM)robve Wrote:  Thanks for sharing!

(03-30-2021 04:58 PM)Dave Britten Wrote:  I'm not sure if the Sharps use binary rather than decimal, but I did notice that solving for PMT in a problem where FV=0, then immediately solving for FV could yield small non-zero values on the order of 1E-5.

FYI. SHARP pocket computers use 10 digits BCD to display values and store values in variables and 12 digits internally to evaluate expressions.

Good to know!

Interestingly, I tested the same TVM program on the EL-5500III that I received in the mail today (this model supports two-character variable names, so explicit * had to be inserted in most of the implied multiplications), and it seems to have better accuracy. Example:

N=360
I=4.75/12 (3.958333333E-01)
PV=141000
FV=0

Solve for PMT, on both machines:
PMT=-735.5227446

Then immediately solve for FV without entering anything else.

PC-1250A (Tandy PC-3):
FV=3.731560805E-05

EL-5500III:
FV=0.
04-01-2021, 05:50 PM
Post: #4
 robve Senior Member Posts: 398 Joined: Sep 2020
RE: PC-1211, PC-1250, etc. TVM
(04-01-2021 04:44 PM)Dave Britten Wrote:  Example:

N=360
I=4.75/12 (3.958333333E-01)
PV=141000
FV=0

Solve for PMT, on both machines:
PMT=-735.5227446

Then immediately solve for FV without entering anything else.

PC-1250A (Tandy PC-3):
FV=3.731560805E-05

EL-5500III:
FV=0.

I also get FV=0 with a PC-1350 with PMT=-732.6227796 reported for DEF-V. This value is also computed with the alternative 100-105 lines.

The S-BASIC interpreter and the CPU on the EL-5500III and PC-1350 are (almost) the same, the forensics: http://www.rskey.org/~mwsebastian/miscprj/results.htm see also http://basic.hopto.org/basic/manual/basic-compare.pdf

The BASIC of the PC-1211 is an earlier S'-BASIC. The PC-1250 is derived from that early version, see: https://sharppocketcomputers.com/#basic

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
 « Next Oldest | Next Newest »

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