Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107150832
D42114.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42114.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D42114: ping: Avoid reporting NaNs
Attached
Detach File
Event Timeline
Log In to Comment