home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-SSP.ARJ / CXPOEV.C < prev    next >
Encoding:
Text File  |  1984-06-20  |  505 b   |  25 lines

  1.      cxpoev(x,y,nd,a,b,c,d)
  2.  
  3.         /*this function evaluates a complex polynomial with*/
  4.         /*complex coeffieicents*/
  5.  
  6.        int nd;
  7.        float x,y,a[],b[],*c,*d;
  8.  
  9.      {
  10.        register int i;
  11.        float r,s,t;
  12.  
  13.         r=0.;
  14.         s=0.;
  15.         for(i = 0; i <= nd-1; i++)
  16.         {
  17.          t = ((r + a[i]) * x) - ((s + b[i]) * y);
  18.          s = ((s + b[i]) * x) + ((r + a[i]) * y);
  19.          r = t;
  20.         }
  21.         *c = r + a[nd];
  22.         *d = s + b[nd];
  23.      }
  24.  
  25.