From e79a6c21164c84d35b699349839a88a7ee13745b Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 23 Feb 2018 12:30:20 +0100 Subject: [PATCH] sourcestats: limit minimum value of std_dev --- sourcestats.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sourcestats.c b/sourcestats.c index 9c1c4dec..ff4c652e 100644 --- a/sourcestats.c +++ b/sourcestats.c @@ -51,6 +51,9 @@ #define MIN_SKEW 1.0e-12 #define MAX_SKEW 1.0e+02 +/* The minimum standard deviation */ +#define MIN_STDDEV 1.0e-9 + /* The asymmetry of network jitter when all jitter is in one direction */ #define MAX_ASYMMETRY 0.5 @@ -571,7 +574,7 @@ SST_DoNewRegression(SST_Stats inst) inst->estimated_offset = est_intercept; inst->offset_time = inst->sample_times[inst->last_sample]; inst->estimated_offset_sd = est_intercept_sd; - inst->std_dev = sqrt(est_var); + inst->std_dev = MAX(MIN_STDDEV, sqrt(est_var)); inst->nruns = nruns; inst->skew = CLAMP(MIN_SKEW, inst->skew, MAX_SKEW); -- 2.47.2