Once more around the hickory shrub. Faster and simpler stddev calculation from

Bill Studenmund.
This commit is contained in:
jwise 1999-02-25 19:07:15 +00:00
parent 0f75831fad
commit bce8ed1c8e
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ping.c,v 1.45 1999/02/25 03:35:34 jwise Exp $ */
/* $NetBSD: ping.c,v 1.46 1999/02/25 19:07:15 jwise Exp $ */
/*
* Copyright (c) 1989, 1993
@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ping.c,v 1.45 1999/02/25 03:35:34 jwise Exp $");
__RCSID("$NetBSD: ping.c,v 1.46 1999/02/25 19:07:15 jwise Exp $");
#endif
#include <stdio.h>
@ -1111,7 +1111,7 @@ summary(int header)
if (nreceived && (pingflags & F_TIMING)) {
double n = nreceived + nrepeats;
double avg = (tsum / n);
double variance = ((tsumsq/n) - avg*avg) * (n/(n-1));
double variance = (tsumsq - n*avg*avg) /(n-1);
printf("round-trip min/avg/max/stddev = "
"%.3f/%.3f/%.3f/%.3f ms\n",