From: Miroslav Lichvar Date: Wed, 19 Jun 2013 08:22:49 +0000 (+0200) Subject: Add minimum skew limit to sourcestats X-Git-Tag: 1.28-pre1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8d609fee54e03d5f2667c1fcdd5b248f18b39f4;p=thirdparty%2Fchrony.git Add minimum skew limit to sourcestats --- diff --git a/sourcestats.c b/sourcestats.c index 616b3262..8df77400 100644 --- a/sourcestats.c +++ b/sourcestats.c @@ -51,6 +51,9 @@ int min_samples; 2000ppm, which would be pretty bad */ #define WORST_CASE_FREQ_BOUND (2000.0/1.0e6) +/* The minimum allowed skew */ +#define MIN_SKEW 1.0e-12 + /* ================================================== */ static LOG_FileID logfileid; @@ -453,6 +456,9 @@ SST_DoNewRegression(SST_Stats inst) inst->variance = est_var; inst->nruns = nruns; + if (inst->skew < MIN_SKEW) + inst->skew = MIN_SKEW; + stress = fabs(old_freq - inst->estimated_frequency) / old_skew; if (best_start > 0) {