HomeFreeBSD

ping: Avoid reporting NaNs

Description

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

(cherry picked from commit 4d348e83b738347f6aaf2b110459a01c5402d04e)

Details

Provenance
jlduran_gmail.comAuthored on Oct 6 2023, 5:55 PM
markjCommitted on Nov 6 2023, 4:45 PM
Reviewer
asomers
Differential Revision
D42114: ping: Avoid reporting NaNs
Parents
rGc21038f55230: arm64: Use the Linux sigframe to restore registers
Branches
Unknown
Tags
Unknown