/
/
/	D  S  I  N
/	-  -  -
/
/SUBROUTINE	DSIN(X)
/
/ VERSION 5A 4-27-77  PT
/
	SECT	DSIN
	JA	#DSIN
	DPCHK
	TEXT	+DSIN  +
SINXR,	SETX	XRSIN
	SETB	BPSIN
FPI2SN,	1		/PI DIVIDED BY 2
	3110	
	3755
	2421
	0264
	3016
FPISIN,	2		/PI
	3110
	3755
	2421
	0264
	3016
F2PISN,	3		/TWO PI
	3110
	3755
	2421
	0264
	3016
BPSIN,	F 0.0
XRSIN,	F 0.0
X,	F 0.0
	F 0.0
	ORG	10*3+BPSIN
	FNOP
	JA 	SINXR
	0
SINRTN,	JA	.
SIN1,	F 0.0
	F 0.0
F3PIB2,	0003			/4.71238898038468986
	2266
	2761
	7714
	6207
	2212
F1SIN,	F 1.0
	F 0.0
/
SINC17,	7720		/1/17!
	3124
	5435
	6014
	1265
	1236
SINC15,	7730		/-1/15!
	4506
	0060
	3063
	0437
	4133
SINC13,	7740		/1/13!
	2604
	4430
	2352
	0664
	1151
SINC11,	7747		/-1/11!
	4506
	3352
	3002
	5354
	3710
SINC9,	7756		/1/9!
	2707
	3616
	4525
	5434
	6350
/
SINC7,	7764		/-1/7!
	4577
	4577
	4577
	4577
	4636
/
SINC5,	7772		/1/5!
	2104
	2104
	2104
	2104
	2104
/
SINC3,	7776		/-1/3!
	5252
	5252
	5252
	5252
	5244
/
SINTST,	7770
	2000
	0000
	0000
	0000
	0000
SEVTHR,	0007
	2217
	7777
	7777
	7777
	7777
	BASE	0
#DSIN,	STARTD
	FLDA	10*3
	FSTA	SINRTN
	FLDA	0
	SETX	XRSIN
	SETB	BPSIN
	BASE	BPSIN
	LDX	1,1	
	LDX	73,2
	FSTA	BPSIN
	FLDA%	BPSIN,1  /ADDR OF X
	FSTA	BPSIN
	STARTE
	FLDA%	BPSIN	/GET X
	LDX	-1,0		/SET SIGN TO POSITIVE.
	JGT	SINMOD		/IF POSITIVE BYPASS FUDGE.
	JEQ	SINRTN		/IF ZERO EXIT.
	FNEG			/NEGATIVE. NEGATE AC. SIN(-X)=-SIN(X)
	LDX	0,0		/SET SIGN TO MINUS.
SINMOD,	FSTA	X
	FDIV	F2PISN		/X/2PI
	ALN	2
	FNORM
	FMUL	F2PISN		/*2PI
	FSTA	SIN1
	FLDA	X
	FSUB	SIN1
	FSTA	SIN1
	FSTA	X
/CHECK FOR QUADRANT
/1 0-PI/2     SIN(PI/2)=1
/2 PI/2-PI    SIN(PI)=0
/3 PI-3PI/2   SIN(3PI/2)=-1
/4 3PI/2-2PI  SIN(2PI)=0
/
	FLDA	FPI2SN		/PI/2
	FSUB	SIN1
	JGT	TAYLOR
	JEQ	SPIB2		/=PI/2
	FLDA	FPISIN		/PI
	FSUB	SIN1
	JLT	S1
	JEQ	SPI		/=PI
	FLDA	FPISIN
	FSUB	SIN1		/SIN(X)=SIN(PI-X)
	FSTA	X
	JA	TAYLOR
S1,	FLDA	F3PIB2		/3PI/2
	FSUB	SIN1
	JLT	S2
	JEQ	S3PIB2	/=3PI/2
	FLDA	SIN1
	FSUB	FPISIN
	FNEG
	FSTA	X		/SIN(X)=-SIN(X-PI)
	JA	TAYLOR
S2,	FLDA	F2PISN		/2PI
	FSUB	SIN1
	JLT	DSNER		/ERROR
	JEQ	SPI
	FNEG
	FSTA	X
/CALCULATE SIN VIA TAYLOR SERIES
TAYLOR,	FLDA	X		/RECALL NUMBER TO BE WORKED ON.
	FMUL	X		/MULTIPLY OUT.
	FSTA	SIN1
	FMUL	SINC17		/NOW DO THE STANDARD ITERATION.
	FADD	SINC15
	FMUL	SIN1
	FADD	SINC13
	FMUL	SIN1
	FADD	SINC11
	FMUL	SIN1
	FADD	SINC9
	FMUL	SIN1
	FADD	SINC7
	FMUL	SIN1
	FADD	SINC5
	FMUL	SIN1
	FADD	SINC3
	FMUL	SIN1
	FADD	F1SIN		/ADD IN 1 FOR SERIES
	FMUL	X		/DO THE FINAL MULTIPLY.
SING,	JXN	SINRTN,0		/SHALL WE NEGATE
	FNEG			/YEP
	JA	SINRTN		/AND RETURN.
SPIB2,	FLDA	F1SIN
	JA	SING
SPI,	FCLA
	JA	SINRTN
S3PIB2,	FLDA	F1SIN
	FNEG
	JA	SING
	EXTERN	#ARGER
DSNER,	TRAP4	#ARGER
