freebsd-src/sbin/ping
Jose Luis Duran 4d348e83b7 ping: Avoid reporting NaNs
Avoid calculating the square root of negative zero, which can easily
happen on certain architectures when calculating the population standard
deviation with a sample size of one, e.g., 0.01 - (0.1 * 0.1) =
-0.000000.

Avoid returning a NaN by capping the minimum possible variance value to
zero (positive).

In the future, maybe skip reporting statistics at all for a single
sample.

Reported by:	Jenkins
Reviewed by:	asomers
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D42114
2023-10-11 13:48:27 -04:00
..
tests ping: Simplify protocol selection. 2023-10-11 00:47:59 +02:00
main.c ping: Simplify protocol selection. 2023-10-11 00:47:59 +02:00
main.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ping.8 ping: The -C option is also supported for IPv6. 2023-09-19 10:47:11 +02:00
ping.c ping: Avoid reporting NaNs 2023-10-11 13:48:27 -04:00
ping.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
ping6.c ping: Avoid reporting NaNs 2023-10-11 13:48:27 -04:00
ping6.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
utils.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
utils.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00