Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/bonyld.bnk
There are 2 other files named bonyld.bnk in the archive. Click here to see a list.
10' NAME--BONDYD
20'
30' DESCRIPTION--BOND YIELD CALCULATION
40'
50' SOURCE--REVISED 8/6/69 BY J. ROKUS
60'
70' INSTRUCTIONS
100'THIS PROGRAM COMPUTES THE BEFORE AND AFTER TAX YIELD TO
110'MATURITY OF A BOND WITH AN ANNUAL COUPON OF C DOLLARS
120'(PAID SEMIANNUALLY), A REDEMPTION PRICE OF R DOLLARS,
130'AND A MATURITY OF M1 YEARS AND M2 MONTHS (M2 NEED NOT
140'BE AN INTEGER), AT A PRICE P.  THE TAX RATE APPLIED TO
150'INTEREST RECEIPTS IS T1; THE RATE APPLIED TO CAPITAL
160'GAINS IS T2; PREMIUM ON PURCHASE ABOVE THE REDEMPTION
170'PRICE IS AMORTIZED OVER THE MATURITY AND DEDUCTED AT
180'T1; DISCOUNT AT PURCHASE BELOW REDEMPTION PRICE IS 
190'TAXED AT MATURITY AT T2.
195'
202' THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL
203' OF HANOVER, N.H. WHICH DOES NOT ASSUME RESPONSIBILITY FOR
204' ITS ACCURACY.
205'
207' * * * * * * * * * * MAIN PROGRAM * * * * * * * * * * * * *
209'
210 READ C,R,M1,M2,P,T1,T2
220 PRINT "COUPON $";FNF(C,10,2);
230 PRINT "   REDEMPTION AT $";FNF(R,10,2);
235 PRINT "     PRICE  $";FNF(P,10,2)
240 PRINT "MATURITY  ";M1;"YEARS     ";M2;"MONTHS"
250 PRINT "TAX RATES :",T1"% ON INCOME",T2"% 0N CAPITAL GAINS"
260 PRINT
263 LET T1=T1/100
266 LET T2=T2/100
270 LET C=C/2 'SEMI-ANNUAL COUPON
280 LET M3=M1*2+M2/6 'TIME TO MATURITY IN SEMI-ANNUAL COUPON PERIODS
290 LET M4=INT(M3) 'NUMBER OF COUPONS INCLUDING FINAL COUPON TO MATURITY
300 LET M5=M3-M4 'TIME TO NEXT COUPON PERIOD
310 IF P<R THEN 340 ' IS BOND SELLING AT A PREMIUM
320 LET D=(P-R)/(M4+1) 'SEMI-ANNUAL AMORTIZATION OF PREMIUM
330 GO TO 350
340 LET D=0
350 LET C2=C-(C-D)*T1 'AFTER TAX AND AMORTIZATION COUPON
360 LET B=P-D*(M4+1) 'BOOK VALUE AT MATURITY
370 LET G=T2*(R-B) 'CAPITAL LOSS REALIZED AT MATURITY
380 LET U1=P+C*(1-M5) ' MARKET VALUE OF BOND PLUS ACCRUED INTEREST
390 LET U2=R ' REDEMPTION PRICE
400 IF M3>6 THEN 430 ' IS TIME TO MATURITY GREATER THAN THREE YEARS
410 GOSUB 710
420 GO TO 440
430 GOSUB 570
440 LET Y=2*(EXP(Y)-1) ' ANNUAL RATE OF RETURN
450 PRINT "YIELD BEFORE TAX     ";100*Y"PERCENT"
460 PRINT
470 LET U1=P+C*(1-M5)*(1-T1) 'AFTER TAX MARKET VALUE PRESENT
480 LET C=C2 ' AFTER TAX SEMI-ANNUAL COUPON
490 LET U2=R-G 'AFTER TAX MARKET VALUE AT MATURITY
500 IF M3>6 THEN 530 ' IS TIME TO MATURITY GREATER THAN THREE YEARS
510 GOSUB 710
520 GO TO 540
530 GOSUB 570
540 LET Y=2*(EXP(Y)-1) 'ANNUAL RATE OF RETURN
550 PRINT "YIELD AFTER TAX     ";100*Y"PERCENT"
560 STOP
565 'FISHER ALGORITHM FOR DETERMINING EXACT RATE OF RETURN
570 LET Y = .0001
580 GOSUB 640
590 LET D = Q-(V1+V2+C)
600 IF ABS(D/V3)<.00000005 THEN 630
610 LET Y = Y-D/V3
620 GO TO 580
630 RETURN
640 LET Q=U1*EXP(Y*M5)
650 LET V1 =C*(1-EXP(-M4*Y))/(EXP(Y)-1)
660 LET V2=U2*EXP(-Y*M4)
670 LET V3 = V2*M4-P*M5
680 LET V3=V3+(C/(EXP(Y)-1)^2)*(EXP(Y)-(M4/EXP(Y*(M4-1))))
690 LET V3=V3+(C/(EXP(Y)-1)^2)*((M4-1)/(EXP(Y*(M4-1))))
700 RETURN
705 'FISHER ALGORITHM FOR DETERMINING EXACT RATE OF RETURN
710 LET Y=.0001
720 GOSUB 780
730 LET D=Q-(V1+V2)
740 IF ABS(D/V3)<.00000005 THEN 770
750 LET Y=Y-D/V3
760 GO TO 720
770 RETURN
780 LET V1=V3=0
790 LET Q=U1
800 LET V2=U2*EXP(-Y*M3)
810 FOR I=0 TO M4
820  LET V1=V1+C*EXP(-Y*(M5+I))
840  LET V3=V3+(M5+I)*C*EXP(-Y*(M5+I))
850 NEXT I
860 LET V3=V3+M3*U2*EXP(-Y*M3)
870 RETURN
900 DEF FNF(X9,W9,D9)
910 DIM P(25)
920 LET P9=INT(ABS(X9)*10^D9+.5)
930 IF P9<10^(W9-1) THEN 960
940 LET FNF=X9
950 GOTO 1180
960 FOR P8=W9 TO W9-D9+1 STEP -1
970 LET P(P8)=P9-10*INT(P9/10)+48
980 IF P(P8)<58 THEN 1000
990 LET P(P8)=0
1000 LET P9=INT(P9/10)
1010 NEXT P8
1020 LET P(W9-D9)=46
1030 FOR P8=W9-D9-1 TO 1 STEP -1
1040 LET P(P8)=P9-10*INT(P9/10)+48
1050 IF P(P8)<58 THEN 1070
1060 LET P(P8)=0
1070 LET P9=INT(P9/10)
1080 IF P9=0 THEN 1100
1090 NEXT P8
1100 IF X9>=0 THEN 1130
1110 LET P(P8-1)=45
1120 LET P8=P8-1
1130 FOR P8=P8-1 TO 1 STEP -1
1140 LET P(P8)=32
1150 NEXT P8
1160 LET P(0)=W9
1170 LET FNF=P
1180 FNEND
2000 DATA 50,1000,2,3,950,48,25
3000 END