home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-SSP.ARJ / CXLOGE.C < prev    next >
Encoding:
Text File  |  1984-08-08  |  453 b   |  18 lines

  1.    cxloge(a,r)
  2.  
  3.       /*  subroutine finds the natural logarithm of a  */
  4.       /*  complex argument.                            */
  5.  
  6.       float a[],r[];
  7.  
  8.     {
  9.       double pi;
  10.       extern double atan(),log(),sqrt();
  11.  
  12.       pi = 3.14159265358979;
  13.       r[0] = log(sqrt(a[0]*a[0] + a[1]*a[1]));
  14.       r[1] = atan(a[1]/a[0]);
  15.       if(a[1] < 0. && a[0] >= 0.) r[1] = r[1] + pi;
  16.       if(a[1] < 0. && a[0] < 0.) r[1] = r[1] - pi;
  17.     }
  18.