Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50161/msin.mp
There are no other files named msin.mp in the archive.
	TITLE MSIN MULTIPLE PRECISION SINE AND COSINE ROUTINE
	SUBTTL V1 UWO 16-NOV-70

	DEFINE CONST(X,Y)
<	MOVM AC1,X
	MOVEI AC0,0
	LSHC AC0,11
	SUBI AC0,200
	ADD AC0,[200000000000]
	LSH AC1,-1
	SKIPGE DX
	MOVNM AC0,AC0
	MOVEM AC0,Y
	MOVEM AC1,Y+1
	ZAP(Y,2)   >

	DEFINE DCONST(DX,Y)
<	MOVM AC1,DX
	MOVEI AC0,0
	LSHC AC0,11
	SUBI AC0,200
	ADD AC0,[200000000000]
	SKIPGE DX
	MOVNM AC0,AC0
	MOVEM AC0,Y
	MOVE AC0,DX
	MOVE AC1,DX+1
	SKIPGE AC0
	DFN AC0,AC1
	LSH AC1,11
	LSHC AC0,10
	TLZ AC0,400000
	LSH AC1,-1
	MOVEM AC0,Y+1
	MOVEM AC1,Y+2
	ZAP (Y,3)   >

	DEFINE ZAP(A,B)
<	MOVE AC2,PREC
	MOVEI AC1,B
	AOS AC2
	CAIG AC2,B
	JRST .+4
	SOS AC2
	SETZM A(AC2)
	JRST .-4 >

	DEFINE DPVAL(X,DY,%ODDERR,%ASS)
<	MOVM AC0,X
	SUB AC0,[200000000000]
	ADDI AC0,200
	MOVEM AC0,EXP#
	TDZE AC0,[777777777400]
	JRST ERROR#
	MOVE AC1,X+1
	MOVE AC2,X+2
	TRNE AC2,100000
	AOS AC2
	JUMPL AC2,%ODDERR
%ASS:	LSH AC2,1
	LSHC AC1,1
	LSHC AC0,33
	LSH AC1,-33
	LSHC AC1,^D18
	MOVE AC2,EXP
	SUBI AC2,33
	LSH AC2,^D27
	IOR AC1,AC2
	SKIPGE X
	DFN AC0,AC1
	MOVEM AC0,DY
	MOVEM AC1,DY+1
	JRST .+7
%ODDERR:	AOS AC1
	TLZN AC2,400000
	JRST %ASS
	LSHC AC1,-1
	JRST %ASS  >

	DEFINE SETPREC (N)
<	MOVEI AC0,N
	MOVEM AC0,PREC#>

	DEFINE COPY(X,Y)
<	IRP Y<
	HRLI AC2,X
	HRRI AC2,Y
	MOVE AC1,PREC
	ADDI AC1,Y
	HRRM AC1,.+1
	BLT AC2,.>>

	DEFINE MADD(X,Y,Z)
<	JSA	16, MADD
	EXP X,Y,PREC,Z
	JRST	OUTNOW>


	DEFINE MMUL(X,Y,Z)
<	JSA 16,MMULT
	EXP X,Y,PREC,Z
	JRST 2  >

	DEFINE MDIV(X,Y,Z)
<	JSA 16,MDIV
	EXP X,Y,PREC,Z
	JRST 3  >

	EXTERN MADD,MMULT,MDIV
	ENTRY MSIN,MCOS

MCOS:	Z
	MOVE 0,@0(16)
	HRRI AC1,@0(16)
	AOS AC1
	HRRM AC1,.+1
	MOVE AC1,.
	MOVEM AC0,DX
	MOVEM AC1,DX+1
	DCONST(DX,X)
	SETPREC(2)
	COPY (ONES,<SUM,TERM>)
	COPY (ZEROS,<N,T1>)
	JRST AGGY-1

MSIN:	0
	MOVE 0,@0(16)
	HRRI AC1,@0(16)
	AOS AC1
	HRRM AC1,.+1
	MOVE AC1,.
	MOVEM AC0,DX
	MOVEM AC1,DX+1
	DCONST(DX,X)
S0:	SETPREC(2)
	COPY (ONES,N)
	COPY (X,<SUM,TERM>)
	MMUL(X,X,X2)
AGGY:	MADD (N,ONES,T1)
	MADD ( T1,ONES,T2)
	MMUL ( X2,TERM,TERM)
	MMUL (T1,T2,T1)
	MDIV(TERM, T1,TERM)
	COPY ( T2,N)
	MOVE AC5,TERM
	MOVNM AC5,TERM
	MADD (SUM,TERM,SUM)
	MOVM AC4,SUM
	MOVM AC5,TERM
	SUB AC4,AC5
	CAIGE AC4,^D70
	JRST AGGY
OUTNOW:	DPVAL(SUM,DANS)
	MOVE AC0,DANS
	MOVE AC1,DANS+1
	JRA 16,1(16)
DANS:	BLOCK 2
DX:	BLOCK 2
ONES:	OCT 200000000001,200000000000,0,0
ZEROS:	OCT 0,0,0,0
TERM:	BLOCK 4
N:	BLOCK 4
SUM:	BLOCK 4
X2:	BLOCK 4
T1:	BLOCK 4
X:	OCT 200000000001,200000000000,0,0
T2:	BLOCK 4
	AC5=5
	AC6=6
	AC4=4
	AC0=0
	AC1=1
	AC2=2
	AC3=3

	END