1 " "LOCK :USING :CLEAR :RADIAN :WAIT 90:ON ERROR GOTO 960
2 PRINT "    COMPLEX ARITHMETIC":PRINT "  Copr. 1982 Tandy Corp.":WAIT :GOTO 51
10 INPUT "1st number real? ";A:GOTO 14
12 GOTO 16
14 INPUT "1st number imaginary? ";B
16 IF J=1LET J=0:RETURN 
18 INPUT "2nd number real? ";C:GOTO 22
20 PAUSE "kept";C
22 INPUT "2nd number imaginary? ";D:RETURN 
24 PAUSE "kept";D:RETURN 
50 "="BEEP 1,125,70:PRINT A,B
51 WAIT 0:PRINT "> Ready"
52 IF INKEY$ <>""THEN 52
53 A$=INKEY$ :IF A$=""THEN 53
54 CLS :WAIT :GOTO A$
200 "+"PAUSE "Add":GOSUB 10:A=A+C:B=B+D:GOTO 50
300 "-"PAUSE "Subtract":GOSUB 10:A=A-C:B=B-D:GOTO 50
400 "*"PAUSE "Multiply":GOSUB 10:E=A*C-B*D:F=B*C+A*D:A=E:B=F:GOTO 50
500 "/"PAUSE "Divide":GOSUB 10:IF C*C+D*D=0PRINT "DIVISOR ZERO!":GOTO 51
510 E=(A*C+B*D)/(C*C+D*D):F=(B*C-A*D)/(C*C+D*D):A=E:B=F:GOTO 50
600 "C"PAUSE "Conjugate":J=1:GOSUB 10:B=-B:GOTO 50
700 "Z"PAUSE "Magnitude":J=1:GOSUB 10:E=SQR (A*A+B*B):BEEP 1,125,70:PRINT "Magnitude";E:GOTO 51
715 I=0:IF E=0AND F=0LET I=1:RETURN 
720 IF E=0LET H=SGN F*PI /2:GOTO 740
725 IF F<>0THEN 730
726 H=0:IF E<0LET H=PI 
727 GOTO 740
730 H=ATN (F/E):IF E<0LET H=H-PI 
740 G=.5*LN (E*E+F*F):RETURN 
750 "L"PAUSE "Logarithm":J=1:GOSUB 10:E=A:F=B:GOSUB 715:IF ITHEN 950
760 A=G:B=H:GOTO 50
800 "X"PAUSE "e^Z":J=1:GOSUB 10:E=EXP A*COS B:F=EXP A*SIN B
810 A=E:B=F:GOTO 50
850 "F"PAUSE "Sine":J=1:GOSUB 10:E=(SIN A*(EXP -B+EXP B))/2:F=(COS A*(EXP B-EXP -B))/2:GOTO 810
900 "G"PAUSE "Cosine":J=1:GOSUB 10:E=(COS A*(EXP -B+EXP B))/2:F=(SIN A*(EXP -B-EXP B))/2:GOTO 810
910 "J"PAUSE "Arc cosine":K=0
911 J=1:GOSUB 10:E=A*A-B*B-1:F=2*A*B:GOSUB 715:IF ITHEN 950
912 E=G/2:F=H/2:G=EXP E*COS F:H=EXP E*SIN F:E=G+A:F=H+B:IF KLET G=-F:F=E:E=G
913 GOSUB 715:IF ITHEN 950
914 A=H:B=-G:GOTO 50
920 "H"PAUSE "Arc sine":K=1:GOTO 911
950 BEEP 3:PRINT "IMPOSSIBLE":GOTO 51
960 BEEP 3:PRINT "UNDEFINED OPERATION":GOTO 51
970 "W"CLEAR :GOTO 51
999 "Q"UNLOCK :END
