       .TITLE SQRT	 COMPUTE SQUARE ROOT FOR REAL ARGUMENT		
/COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
	/EDIT 3 8--14--70
       .GLOBL SQRT,.DA,.AA,.AB,.AG,.AH,.AN,.AI,.ER		
/      JMS*   (SQRT)	SUBR CALL 			
/      JMP    .+2		SUBR RETURN (ROOT IN FLOATING ACC)	
/      CAL/XCT ADDR 	ADDR OF ARGUMENT (XCT IF INDIRECT)	
/
SQRT   CAL    0	         /ENTRY-EXIT			
       JMS*   .DA	         /GET ARGUMENT			
       JMP    SQRT02					
SQRT01 CAL    0	         /(ADDR OF ARG)			
SQRT02 JMS*   .AG	         /LOAD REAL 			
       .DSA   SQRT01+400000  / (ARG)				
SQRT11 LAC*   .AB	         /GET SIGN WORD
	SPA
       JMP    SQRT10         /ERROR IF .LT.ZERO			
	SNA
       JMP*   SQRT	         /SQRT IS ZERO IF ARG IS ZERO		
       LAC*   .AA	         /GET EXP				
	SPA!CLL
	CML
	RAR
	DAC* .AA
       AND    SQRT04         /KEEP LOWER 9 BITS			
       DAC    SQRT05         /STORE AS EXP OF K (K= .5 * 2**EXP/2)	
	LAC* .AA
       SNL	         /WAS EXP ODD			
       TAD    SQRT06         / NO-SET TO SHIFT ARG TO ARG12 BEFORE ADD
       DAC*   .AA						
       JMS*   .AI	         /ADD REAL				
       .DSA   SQRT05         / (K + ARG)  OR (K + ARG12) = PO	
	LAW -4		/SET ITERATION COUNTER.
       DAC    SQRT05					
SQRT13 JMS*   .AH	         /STORE REAL			
       .DSA   SQRT09         / (P(N))				
       JMS*   .AN	         /REVERSE DIVIDE REAL 		
       .DSA   SQRT01+400000  / (ARG/P(N))			
       JMS*   .AI	         /ADD REAL				
       .DSA   SQRT09         / (P(N) + ARG/P(N))			
       LAW    -1	         /EXP = EXP -1 (DIVIDE BY 2)		
       TAD*   .AA						
       DAC*   .AA						
       ISZ    SQRT05         /BUMP COUNTER			
       JMP    SQRT13         /MORE ITERATIONS			
       JMP*   SQRT	         /EXIT				
SQRT10 AND    (377777)
       DAC*   .AB
       JMS*   .ER	         /ERROR ROUTINE
       .DSA   400005         /ERR 5
       JMP    SQRT11
SQRT06	    777777         /CONSTANT (-1)			
SQRT04	    777	         /EXP MASK FOR NEG EXP		
SQRT05 CAL    0	         /EXP OF K (SET TO ARG EXP/2) ALSO ITER CNTR
	    200000         /K = 0.5				
SQRT09 CAL    0	         /STORAGE FOR P(N) (1)		
       CAL    0	         /	       (2)		
	.END
