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

Details

Provenance
jlduran_gmail.comAuthored on Oct 6 2023, 5:55 PM
markjCommitted on Oct 11 2023, 5:48 PM
Reviewer
asomers
Differential Revision
D42114: ping: Avoid reporting NaNs
Parents
rG04b465777a09: bsdinstall auto: replace dialog with bsddialog
Branches
Unknown
Tags
Unknown