/
/
/
/	D  A  T  A  N  2
/	-  -  -  -  -  -
/
/SUBROUTINE	DATAN2(Y,X)
/
/ VERSION 5A 4-27-77  PT
/
	SECT	DATAN2
	JA	#DATN2
	DPCHK
	TEXT	+DATAN2+
ATN2XR,	SETX	XRATN2
	SETB	BPATN2
BPATN2,	FNOP
	0
	0
XRATN2,	F 0.0
YCOR,	F 0.0
	0;0;0
XCOR,	F 0.0
	0;0;0
	ORG	10*3+BPATN2
	FNOP
	JA	ATN2XR
	0
AT2RTN,	JA	.
FPIAT2,	2
	3110		/PI
	3755
	2421
	0264
	3016
ATPI,	0001
	3110		/PI/2
	3755
	2421
	0264
	3016
	BASE	0
#DATN2,	STARTD
	FLDA	10*3
	FSTA	AT2RTN
	FLDA	0
	SETX	XRATN2
	SETB	BPATN2
	BASE	BPATN2
	LDX	1,1
	FSTA	BPATN2
	FLDA%	BPATN2,1	/ADDR OF Y
	FSTA	YCOR
	FLDA%	BPATN2,1+	/ADDR OF X
	FSTA	XCOR
	STARTE
	FLDA%	YCOR
	FSTA	YCOR		/SAVE FOR A SECOND
	LDX	1,2		/POSITIVE Y
	JEQ	ATN0
	JGT	ATN1
	LDX	0,2
ATN1,	FLDA%	XCOR		/GET X - THE QUADRAND
	FSTA	XCOR		/+MOVE IT TO A SAFE PLACE
	JEQ	ATASP
	FLDA	YCOR		/Y/X
	FDIV	XCOR
	FSTA	YCOR
	EXTERN	DATAN
	JSR	DATAN		/CALL ATAN
	JA	.+4		/TAKE ARCTAN OF Y/X
	JA	YCOR
	FSTA	YCOR		/SAVE IT AWAY
	JGE	A2		/SKIP IF 1ST OR 3RD QUADS
	FADD	FPIAT2		/ADD PI FOR 4TH QUAD
	FSTA	YCOR
A2,	JXN	AT2RTN,2	/DONE IF 1 OR 4 Q
	FLDA	YCOR
	FSUB	FPIAT2		/2ND OR 3RD Q
	JA	AT2RTN
ATASP,	FLDA	ATPI		/PI/2
	JXN	ATNG,2
	FNEG
ATNG,	JA	AT2RTN
ATN0,	FLDA%	XCOR
	JLT	POSX
	FCLA			/X POS, ANS =0
	JA	AT2RTN
POSX,	FLDA	FPIAT2		/X LT 0, ANS = PI
	JA	AT2RTN
