Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pythag.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pythag.f
1 
2  DOUBLE PRECISION FUNCTION pythag(A,B)
3  DOUBLE PRECISION a,b
4 C
5 C FINDS DSQRT(A**2+B**2) WITHOUT OVERFLOW OR DESTRUCTIVE UNDERFLOW
6 C
7  DOUBLE PRECISION p,r,s,t,u
8  p = dmax1(dabs(a),dabs(b))
9  IF (p .EQ. 0.0d0) goto 110
10  r = (dmin1(dabs(a),dabs(b))/p)**2
11  100 CONTINUE
12  t = 4.0d0 + r
13  IF (t .EQ. 4.0d0) goto 110
14  s = r/t
15  u = 1.0d0 + 2.0d0*s
16  p = u*p
17  r = (s/u)**2 * r
18  goto 100
19  110 pythag = p
20  RETURN
21  END