function cabs (z) c december 1978 version. w. fullerton, c3, los alamos scientific lab. complex z external r1mach, sqrt data sqeps, big, xmax / 3*0.0/ c if (sqeps.ne.0.0) go to 10 sqeps = sqrt (r1mach(4)) xmax = r1mach(2) big = xmax/1.415 c 10 x = abs (real (z)) y = abs (aimag (z)) r1 = amin1 (x, y) r2 = amax1 (x, y) c if (r1.gt.big) go to 20 cabs = r2 if (r1.gt.r2*sqeps) cabs = r2*sqrt(1.0+(r1/r2)**2) return c 20 r1 = sqrt (1.0+(r1/r2)**2) if (r2.gt.xmax/r1) call seteru ( 1 46hcabs cabs(z) overflows because z is too big, 46, 1, 2) cabs = r2*r1 return c end .