/
/
/	A  T  A  N
/	-  -  -  -
/
/SUBROUTINE	ATAN(X)
/
/ VERSION 5A 4-27-77  PT
/
	SECT	ATAN
	JA	#ATAN
	TEXT	+ATAN  +
ATANXR,	SETX	XRATAN
	SETB	BPATAN
BPATAN,	F 0.0
XRATAN,	F 0.0
ATAN1,	F 0.0
ATAN22,	F 0.0
ATAN3,	F 0.0
ATAN4,	F 0.0
F1ATAN,	F 1.
	ORG	10*3+BPATAN
	FNOP
	JA	ATANXR
	0
ATNRTN,	JA	.
/
ATANC1,	-15			/LOWER LIMIT TEST.
	2000
	0000
/
ATANC2,	0			/UPPER LIMIT TEST.
	3777
	7000
/
ATANC3,	-1
	2111
	4121
/
ATANC4,	1
	3355
	4754
/
ATANC5,	0
	2060
	2511
/
ATANC6,	-3
	3023
	1227
/
ATANC7,	-2
	5566
	7220
/
ATANC8,	-2
	3146
	0740
/
ATANC9,	-1
	5252
	5262
/
ATANCH,	1
	3110
	3755
/
ATANCJ,	F -4.
	BASE	0
#ATAN,	STARTD
	FLDA	10*3
	FSTA	ATNRTN
	FLDA	0
	SETX	XRATAN
	SETB	BPATAN
	BASE	BPATAN
	LDX	1,1	
	FSTA	BPATAN
	FLDA%	BPATAN,1  /ADDR OF X
	FSTA	BPATAN
	STARTF
	FLDA%	BPATAN	/GET X
	LDX	-1,0		/REMEMBER SIGN
	JGE	.+5
	LDX	0,0		/SAVE THE SIGN.
	FNEG			/NEGATE THE FAC [ABS]
	FSTA	ATAN1		/AND STORE AWAY.
	FSTA	ATAN22
	FSUB	ATANC1		/TEST TO SEE IF TOO SMALL.
	JLE	ATANBG		/IT IS. ATAN(X)=X
	FSUB	ATANC2		/TEST TO SEE IF TOO BIG.
	JLE	ATANLW		/IT ISNT.
	FLDA	F1ATAN		/TO BIG. INVERT IT.
	FDIV	ATAN1
	FSTA	ATAN1
/
ATANLW,	FCLA			/CLEAR OUT TEMP.
	FSTA	ATAN3
	FLDA	ATAN1		/RECALL NUMBER.
	FSUB	ATANC3		/START THE KNOCKING OFF PROCESS.
	JLT	ATANNT		/WRONG SECTOR.
	FLDA	ATANC4		/BOP UP ORIGINAL.
	FADDM	ATAN1
	FLDA	ATANCJ		/GET MAGIC NUMBER.
	FDIV	ATAN1
	FADD	ATANC4
	FSTA	ATAN1
	FLDA	ATANC5
	FSTA	ATAN3
/
ATANNT,	FLDA	ATAN1		/RECALL AND SQUARE IT.
	FMUL	ATAN1
	FSTA	ATAN4		/YET ANOTHER TEMP.
	FLDA	ATANC6
	FMUL	ATAN4
	FADD	ATANC7
	FMUL	ATAN4
	FADD	ATANC8
	FMUL	ATAN4
	FADD	ATANC9
	FMUL	ATAN4
	FADD	F1ATAN
	FMUL	ATAN1
	FADD	ATAN3
	FSTA    ATAN1
	FLDA	ATAN22
	FSUB	F1ATAN
	JLE	ATANBG
	FLDA	ATANCH
	FSUB	ATAN1
	JA	.+3
/
ATANBG,	FLDA	ATAN1
	JXN	ATNRTN,0
	FNEG
	JA	ATNRTN
