"Fossies" - the Fresh Open Source Software Archive

Member "ccmath-2.2.1/benchmk/timnrml.c" (16 Oct 2000, 985 Bytes) of package /linux/misc/old/ccmath-2.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "timnrml.c" see the Fossies "Dox" file reference documentation.

    1 /*  timnrml.c    CCMATH mathematics library source code.
    2  *
    3  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
    4  *  This code may be redistributed under the terms of the GNU library
    5  *  public license (LGPL). ( See the lgpl.license file for details.)
    6  * ------------------------------------------------------------------------
    7  */
    8 /*
    9     Time the generation of pseudorandom normals
   10 
   11     Input parameter:  n -> number of normals generated
   12 */
   13 #include <time.h>
   14 #include "ccmath.h"
   15 void main(int na,char **av)
   16 { unsigned int i,n; double x;
   17   clock_t st,en; double dt;
   18   if(na!=2){ printf("para: count\n"); exit(1);}
   19   n=atoi(*++av);
   20   i=123456789; setnrml(i);
   21   printf("    Timing Random Normal Generator nrml()\n");
   22   printf("  number generated= %ld\n",n);
   23   st=clock();
   24   for(i=0; i<n ;++i) x=nrml();
   25   en=clock();
   26   dt=(double)(en-st)/(double)CLOCKS_PER_SEC;
   27   printf(" time= %7.3f sec.\n",dt);
   28   dt*=1.e6/(double)n;
   29   printf("   %6.3f usec. per evaluation\n",dt); 
   30 }