From e1ad84e31e8c7e39b17bcf7d1c1a5c281e392f98 Mon Sep 17 00:00:00 2001 From: octo Date: Tue, 16 May 2006 19:10:46 +0000 Subject: [PATCH] Correct the calculation of the standard deviation. --- src/oping.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/oping.c b/src/oping.c index 37f64b2..5940001 100644 --- a/src/oping.c +++ b/src/oping.c @@ -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, -- 2.11.0