Subversion Repositories shark

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed


long t[PREC];
long counter;
long hoops;
long maxv=0;

void d_init(void)
{
  int i;
  hoops=counter=0;
  for (i=0;i<PREC;i++) t[i]=0;
}

void d_insert(long d)
{
  if (d>=MAXX) {
    hoops++;
    if (d>maxv) maxv=d;
    return;
  }

  counter++;
  t[(int)(d/DELTA)]++;
}

void d_dump(FILE *fout)
{
  int i;

  if (counter==0) {
    fprintf(stderr,"nothing to write to the output file\n");
    return;
  }
 
  if (hoops) {
    fprintf(stderr,"%li values to big (max=%li)\n",hoops,maxv);
  }
 
  for (i=0;i<PREC;i++)
    fprintf(fout,"%f %f\n",
            DELTA/2.0+DELTA*i,
            (double)t[i]/(double)counter
            );
}