home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-SSP.ARJ / SIMSEC.TST < prev    next >
Encoding:
Text File  |  1984-08-31  |  1.1 KB  |  35 lines

  1.         /* General form test program for scientific functions */
  2.  
  3.         /* Routine Tested:  SIMSEC */
  4.  
  5.         main()
  6.  
  7.         {
  8.         int *fp,numrt;
  9.         static float a[6]={2.,5.,2.,1.,0.,-1.},
  10.                      b[6]={1.,3.,2.,0.,-3.,1.};
  11.         float x[3],y[3],tol;
  12.  
  13.         tol = .001;
  14.  
  15.         simsec(a,b,x,y,tol,&numrt);
  16.  
  17.         *fp=fopen("PRN:","w");                /* open the printer */
  18.  
  19.         fprintf(*fp,"Test Results from SIMSEC\n\n");
  20.          printf("Test Results from SIMSEC\n\n");
  21.  
  22.         fprintf(*fp," NUMRT = %d\n\n",numrt);
  23.          printf(" NUMRT = %d\n\n",numrt);
  24.  
  25.         fprintf(*fp,"ROOTS   REAL                  IMAGINARY\n");
  26.          printf("ROOTS   REAL                  IMAGINARY\n");
  27.         fprintf(*fp,"  %15.7f       %15.7f\n",x[0],y[0]);
  28.          printf("  %15.7f       %15.7f\n",x[0],y[0]);
  29.         fprintf(*fp,"  %15.7f       %15.7f\n",x[1],y[1]);
  30.          printf("  %15.7f       %15.7f\n",x[1],y[1]);
  31.         fprintf(*fp,"  %15.7f       %15.7f\n",x[2],y[2]);
  32.          printf("  %15.7f       %15.7f\n",x[2],y[2]);
  33.      }
  34.  
  35.