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

  1.      plyevl(a,nd,x,ans)
  2.  
  3.         /*this function evaluates any single variable polynomial*/
  4.         /*of the form a(1)*x**nd+a(2)*x**(nd-1)+... +a(nd)*x+a(nd+1)*/
  5.  
  6.       int nd;
  7.       float a[],x,*ans;
  8.  
  9.     {
  10.       register int i;
  11.  
  12.        *ans = a[0];
  13.         if(nd != 0)
  14.          {
  15.          for(i = 0; i <= nd-1; i++)
  16.           *ans = (*ans *x) + a[i+1];
  17.          }
  18.     }
  19.  
  20.  
  21.