Code

Correct the calculation of the standard deviation.
authorocto <octo>
Tue, 16 May 2006 19:10:46 +0000 (19:10 +0000)
committerocto <octo>
Tue, 16 May 2006 19:10:46 +0000 (19:10 +0000)
src/oping.c

index 37f64b27a76831980bb60ddb48e2fc4b8c95301e..5940001bea1407bc1b331ffb1dbdaef23ec1bef0 100644 (file)
@@ -401,7 +401,8 @@ int main (int argc, char **argv)
                        num_total = (double) context->req_rcvd;
 
                        average = context->latency_total / num_total;
-                       deviation = sqrt (context->latency_total_square - (num_total * average * average));
+                       deviation = sqrt (((num_total * context->latency_total_square) - (context->latency_total * context->latency_total))
+                                       / (num_total * (num_total - 1.0)));
 
                        printf ("rtt min/avg/max/sdev = %.3f/%.3f/%.3f/%.3f ms\n",
                                        context->latency_min,