/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to tools/disp.cs

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-28 23:02:52 UTC
  • Revision ID: csa@dside.dyndns.org-20090928230252-d05nbdkg6q4zvu8i
Mono validation and transformation benchmarks

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
 
 
3
namespace XMLBench {
 
4
 public class Disp {
 
5
    public long disp_n=0;
 
6
    public double disp_s=0;
 
7
    public double disp_d=0;
 
8
    public double disp_m=0;
 
9
 
 
10
    public void disp_init() {
 
11
        disp_n=0;
 
12
        disp_s=0;
 
13
        disp_d=0;
 
14
    }
 
15
    
 
16
    public void disp_event(double disp_v) {
 
17
        long t;
 
18
        
 
19
        disp_n++;
 
20
        t=disp_n*(disp_n-1);
 
21
        
 
22
        disp_s+=disp_v;
 
23
        disp_v*=disp_n;
 
24
 
 
25
        if (t>0) disp_d+=(double)(((disp_s-disp_v)*(disp_s-disp_v)))/t;
 
26
    }
 
27
 
 
28
    public void disp_post() {
 
29
        if (disp_n>0) {
 
30
            disp_m = ((double)disp_s) / disp_n;
 
31
            if (disp_n>1) {
 
32
                disp_d /= (disp_n-1);
 
33
                disp_d = Math.Sqrt(disp_d);
 
34
            }
 
35
        }
 
36
    }   
 
37
 }
 
38
}
 
 
b'\\ No newline at end of file'