       .TITLE DSQRT  COMPUTE SQUARE ROOT FOR DOUBLE ARGUMENT
/COPYRIGHT 1970, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
/EDIT 2   10-22-70
       .GLOBL DSQRT,.DA,.AA,.AB,.AO,.AP,.AV,.AQ,.ER
/             CALLING SEQUENCE
/      JMS*   (DSORT)         SUBR CALL
/      JMP    .+2             SUBR RETURN (ROOT IN FLOATING ACC)
/      CAL/XCT ADDR           ADDR OF ARGUMENT (XCT IF INDIRECT)
/
DSQRT  CAL    0              /ENTRY-EXIT
       JMS*   .DA            /GET ARGUMENT
       JMP    DSQR02
DSQR01 CAL    0              /(ARG ADDR)
DSQR02 JMS*   .AO            /LOAD REAL
       .DSA   DSQR01+400000  / (ARG)
DSQR11 LAC*   .AB            /GET SIGN WORD
	SPA
       JMP    DSQR10         /ERROR IF .LT. ZERO
	SNA
       JMP*   DSQRT          /ROOT = ZERO IF ARG = ZERO
       LAC*   .AA            /GET ARG EXP (X)
	CLL!SPA
	CML
	RAR
	DAC DSQR05	/SET EXP OF CONSTANT (K) = X/2
       SNL                   /WAS (X) ODD
       TAD    DSQR06         / NO-SET A = X/2 -1
       DAC*   .AA            /SET EXP OF ARG = X/2 OR X/2 -1 (FORCE SFT)
       JMS*   .AQ            /ADD DOUBLE
       .DSA   DSQR05         / (ARG + K = P(O))
	LAW -5		/SET ITERATION COUNTER
       DAC    DSQR05
DSQR13 JMS*   .AP            /STORE DOUBLE
       .DSA   DSQR09         / (P(N))
       JMS*   .AV            /REVERSE DIVIDE DOUBLE
       .DSA   DSQR01+400000  / (ARG/P(N))
       JMS*   .AQ            /ADD DOUBLE
       .DSA   DSQR09         / (P(N)+(ARG/P(N)))
       LAW    -1             /SET EXP OF ABOVE
       TAD*   .AA            / TO EXP-1 (DIVIDE ARG BY 2)
       DAC*   .AA
       ISZ    DSQR05         /BUMP ITERATION COUNTER
       JMP    DSQR13         /MORE TO GO-CYCLE
       JMP*   DSQRT          /DONE-EXIT
DSQR10 AND    (377777)
       DAC*   .AB
       JMS*   .ER            /ERROR ROUTINE
       .DSA   400006         /ERR 6
       JMP    DSQR11
DSQR05 CAL    0              /EXP OF K (= EXP/2 OF ARG) ALSO ITER CNTR
              200000
              0
DSQR06        777777         /CONSTANT OF -1
DSQR09 CAL    0              /STORAGE FOR P(N)
       CAL    0              /  (2)
       CAL    0              /  (3)
	.END
