public static double abs(Z z){
  double are, aim, rho;
  are=Math.abs(z.re);
  aim=Math.abs(z.im);
  if (are + aim == 0)   return 0;
  if (are >= aim) {
    rho=aim / are;
    return are * Math.sqrt(1 + rho * rho);
  }
 else {
    rho=are / aim;
    return aim * Math.sqrt(1 + rho * rho);
  }
}

public static double abs ( Z z ) { double are , aim , rho ; are = Math . abs ( z . re ) ; aim = Math . abs ( z . im ) ; if ( are + aim == 0 ) return 0 ; if ( are >= aim ) { rho = aim / are ; return are * Math . sqrt ( 1 + rho * rho ) ; } else { rho = are / aim ; return aim * Math . sqrt ( 1 + rho * rho ) ; } }
computes the absolute value of a z .
