      function lsdpythag(a,b)
      double precision a,b,lsdpythag
      double precision absa,absb
      absa=dabs(a)
      absb=dabs(b)
      if(absa.gt.absb)then
        lsdpythag=absa*dsqrt(1.D0+(absb/absa)**2)
      else
        if(absb.eq.0.D0)then
          lsdpythag=0.D0
        else
          lsdpythag=absb*dsqrt(1.D0+(absa/absb)**2)
        endif
      endif
      return
      END
C  (C) Copr. 1986-92 Numerical Recipes Software )$(.
