Subversion Repositories shark

Rev

Rev 1085 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1085 pj 1
 
2
long t[PREC];
3
long counter;
4
long hoops;
5
long maxv=0;
6
 
7
void d_init(void)
8
{
9
  int i;
10
  hoops=counter=0;
11
  for (i=0;i<PREC;i++) t[i]=0;
12
}
13
 
14
void d_insert(long d)
15
{
16
  if (d>=MAXX) {
17
    hoops++;
18
    if (d>maxv) maxv=d;
19
    return;
20
  }
21
 
22
  counter++;
23
  t[(int)(d/DELTA)]++;
24
}
25
 
26
void d_dump(FILE *fout)
27
{
28
  int i;
29
 
30
  if (counter==0) {
31
    fprintf(stderr,"nothing to write to the output file\n");
32
    return;
33
  }
34
 
35
  if (hoops) {
36
    fprintf(stderr,"%li values to big (max=%li)\n",hoops,maxv);
37
  }
38
 
39
  for (i=0;i<PREC;i++)
40
    fprintf(fout,"%f %f\n",
41
            DELTA/2.0+DELTA*i,
42
            (double)t[i]/(double)counter
43
            );
44
}