diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-17 17:57:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-17 17:57:35 +0000 |
commit | 3b95e5be69c199a2a195c57aba12d88c242225ac (patch) | |
tree | 137b72ffaefe7f34bf21e975ccc9cc9ec0474564 /libnetdata/statistical/statistical.c | |
parent | Adding upstream version 1.13.0. (diff) | |
download | netdata-b9ac22f8da656f8703bea7c713068a397e01c714.tar.xz netdata-b9ac22f8da656f8703bea7c713068a397e01c714.zip |
Adding upstream version 1.14.0~rc0.upstream/1.14.0_rc0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/statistical/statistical.c')
-rw-r--r-- | libnetdata/statistical/statistical.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libnetdata/statistical/statistical.c b/libnetdata/statistical/statistical.c index 15792fd15..ba8f0c45a 100644 --- a/libnetdata/statistical/statistical.c +++ b/libnetdata/statistical/statistical.c @@ -23,7 +23,7 @@ inline LONG_DOUBLE sum_and_count(const LONG_DOUBLE *series, size_t entries, size size_t c = 0; for(value = series; value < end ; value++) { - if(isnormal(*value)) { + if(calculated_number_isnumber(*value)) { sum += *value; c++; } @@ -62,7 +62,7 @@ LONG_DOUBLE moving_average(const LONG_DOUBLE *series, size_t entries, size_t per for(i = 0, count = 0; i < entries; i++) { LONG_DOUBLE value = series[i]; - if(unlikely(!isnormal(value))) continue; + if(unlikely(!calculated_number_isnumber(value))) continue; if(unlikely(count < period)) { sum += value; @@ -173,7 +173,7 @@ LONG_DOUBLE running_median_estimate(const LONG_DOUBLE *series, size_t entries) { for(i = 0; i < entries ; i++) { LONG_DOUBLE value = series[i]; - if(unlikely(!isnormal(value))) continue; + if(unlikely(!calculated_number_isnumber(value))) continue; average += ( value - average ) * 0.1f; // rough running average. median += copysignl( average * 0.01, value - median ); @@ -193,7 +193,7 @@ LONG_DOUBLE standard_deviation(const LONG_DOUBLE *series, size_t entries) { LONG_DOUBLE sum; for(count = 0, sum = 0, value = series ; value < end ;value++) { - if(likely(isnormal(*value))) { + if(likely(calculated_number_isnumber(*value))) { count++; sum += *value; } @@ -205,7 +205,7 @@ LONG_DOUBLE standard_deviation(const LONG_DOUBLE *series, size_t entries) { LONG_DOUBLE average = sum / (LONG_DOUBLE)count; for(count = 0, sum = 0, value = series ; value < end ;value++) { - if(isnormal(*value)) { + if(calculated_number_isnumber(*value)) { count++; sum += powl(*value - average, 2); } @@ -232,7 +232,7 @@ LONG_DOUBLE single_exponential_smoothing(const LONG_DOUBLE *series, size_t entri LONG_DOUBLE level = (1.0 - alpha) * (*value); for(value++ ; value < end; value++) { - if(likely(isnormal(*value))) + if(likely(calculated_number_isnumber(*value))) level = alpha * (*value) + (1.0 - alpha) * level; } @@ -250,7 +250,7 @@ LONG_DOUBLE single_exponential_smoothing_reverse(const LONG_DOUBLE *series, size LONG_DOUBLE level = (1.0 - alpha) * (*value); for(value++ ; value >= series; value--) { - if(likely(isnormal(*value))) + if(likely(calculated_number_isnumber(*value))) level = alpha * (*value) + (1.0 - alpha) * level; } @@ -281,7 +281,7 @@ LONG_DOUBLE double_exponential_smoothing(const LONG_DOUBLE *series, size_t entri const LONG_DOUBLE *value = series; for(value++ ; value >= series; value--) { - if(likely(isnormal(*value))) { + if(likely(calculated_number_isnumber(*value))) { LONG_DOUBLE last_level = level; level = alpha * *value + (1.0 - alpha) * (level + trend); |