Page MenuHomeFreeBSD

D42114.diff
No OneTemporary

D42114.diff

diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1522,10 +1522,10 @@
if (nreceived && timing) {
double n = nreceived + nrepeats;
double avg = tsum / n;
- double vari = tsumsq / n - avg * avg;
+ double stddev = sqrt(fmax(0, tsumsq / n - avg * avg));
(void)printf(
"round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n",
- tmin, avg, tmax, sqrt(vari));
+ tmin, avg, tmax, stddev);
}
if (nreceived)
diff --git a/sbin/ping/ping6.c b/sbin/ping/ping6.c
--- a/sbin/ping/ping6.c
+++ b/sbin/ping/ping6.c
@@ -2349,10 +2349,10 @@
/* Only display average to microseconds */
double num = nreceived + nrepeats;
double avg = tsum / num;
- double dev = sqrt(tsumsq / num - avg * avg);
+ double stddev = sqrt(fmax(0, tsumsq / num - avg * avg));
(void)printf(
"round-trip min/avg/max/std-dev = %.3f/%.3f/%.3f/%.3f ms\n",
- tmin, avg, tmax, dev);
+ tmin, avg, tmax, stddev);
(void)fflush(stdout);
}
(void)fflush(stdout);

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 9:45 PM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15758117
Default Alt Text
D42114.diff (1 KB)

Event Timeline