      SUBROUTINE SQRTM(A,IA,B,IB)
C
C     SCALED ARITHMETIC ROUTINES--SQUARE ROOT
C
      DIMENSION IPSW(1)
      DOUBLE PRECISION A,B
      DOUBLE PRECISION DETSW(1)
      A = B
      IA = IB
      IF(MOD(IA,2) .EQ. 0) GO TO 10
      IA = IA-1
      A = A*10.0
   10 IA=IA/2
      A = DSQRT(DMAX1(A,0.D0))
   20 RETURN
C
C     DCALE OF DETERMINANT BY FACTORS OF 10
C
      ENTRY DETM6(DETSW,IPSW)
      IF(DETSW(1) .EQ. 0.0D0) GO TO 20
   30 IF(DABS(DETSW(1)) .GT. 10.0D0) GO TO 50
   40 IF(DABS(DETSW(1)) .LT. 0.1D0) GO TO 60
      GO TO 20
   50 DETSW(1) = DETSW(1)*0.1D0
      IPSW(1) = IPSW(1)+1
      GO TO 30
   60 DETSW(1) = DETSW(1)*10.0D0
      IPSW(1) = IPSW(1)-1
      GO TO 40
      END
