1 " "LOCK :WAIT 90:CLEAR :DIM ME$(0)*26:USING :ON ERROR GOTO 900
2 CLS :PRINT " INTERNAL RATE OF RETURN"
3 PRINT "  Copr. 1982 Tandy Corp."
10 RESTORE :WAIT 0:FOR I=1TO 4:CLS :READ ME$(0):PRINT ME$(0):FOR J=1TO 75:A$=INKEY$ :IF A$<>""LET J=75
11 NEXT J
12 J=0:FOR K=1TO 3:IF MID$ ("ABX",K,1)=A$LET J=K:K=3
13 NEXT K:IF J>0LET I=4:NEXT I:WAIT :GOTO A$
14 NEXT I:GOTO 10
20 DATA "Select Function:"
21 DATA "Find present value: A"
22 DATA "Find IRR: B"
27 DATA "Exit program: X"
100 "A"GOSUB "IMV":GOSUB "INY":GOSUB "ICV":INPUT "Rate of return (%)? ";Y
105 GOSUB "CA"
110 R=Y/100+1:A=M*R^-N:Z=0:FOR J=1TO N:T=R^-J:Z=Z+T:NEXT J:P=I*Z+A:P=.01*INT (100*P+.5)
120 BEEP 2:CLS :PRINT "Present value $";STR$ P:GOTO 10
200 "B"INPUT "Present value? $";P
205 GOSUB "IMV":GOSUB "INY":GOSUB "ICV":IF N=1LET Y=((M+I)/P-1)*100:GOTO "JP"
210 A=1:D=.5:C=D:GOSUB "CA"
220 "LP1"E=C:FOR J=1TO N-1:E=E*C+C:NEXT J:F=C^N*M+E*I:F=1E-4*INT (1E4*F+.5):IF F>=PTHEN "LP2
230 D=C:C=(C+A)/2:GOTO "LP1"
240 "LP2"IF F=PTHEN "LP3"
250 A=C:C=(C+D)/2:GOTO "LP1"
260 "LP3"Y=(1/C-1)*100
270 "JP"Y=.01*INT (100*Y+.5):BEEP 2:CLS :PRINT "Rate of return =";Y;"%":GOTO 10
300 "ICV"INPUT "Annual return? $";I
301 RETURN 
400 "INY"INPUT "Number of years? ";N
410 RETURN 
500 "IMV"INPUT "Future value? $";M
510 RETURN 
600 "CA"WAIT 0:CLS :CURSOR 5:PRINT "* CALCULATING *":WAIT :RETURN 
900 PRINT "*** ERROR";PEEK &789B;" in";STATUS 4;" ***":GOTO 10
999 "X"UNLOCK :END
