1.0.3 Statistic

This commit is contained in:
Rob Tillaart 2023-05-10 14:38:27 +02:00
parent 43f55d1eaa
commit da7349212d
5 changed files with 23 additions and 11 deletions

View File

@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.3] - 2023-05-09
- fix #13 **sqrtf()** missing
- prep more correct NaN when \_cnt == 0;
## [1.0.2] - 2023-03-14
- update readme.md
- update FAQ.md
@ -12,7 +16,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- update license 2023
- minor edits
## [1.0.1] - 2022-11-25
- simplified changelog.md

View File

@ -114,7 +114,11 @@ See https://github.com/RobTillaart/Statistic/blob/master/FAQ.md
- return values of **sum(), minimum(), maximum()** when **count()** == zero
- should these be NaN, which is technically more correct?
- does it exist for all value types? => No!
- for now user responsibility to check **count()** first.
- refactor \_cnt to \_count
- remove deprecated methods. (1.1.0)
#### Could

View File

@ -4,7 +4,7 @@
// AUTHOR: Rob Tillaart
// modified at 0.3 by Gil Ross at physics dot org
// template version 1.0.0 by Glen Cornell
// VERSION: 1.0.2
// VERSION: 1.0.3
// PURPOSE: Recursive Statistical library for Arduino
// HISTORY: See CHANGELOG.md
//
@ -37,7 +37,7 @@
// and HAVE_STDCXX_CSTDINT feature macros in your build environment.
#define STATISTIC_LIB_VERSION (F("1.0.2"))
#define STATISTIC_LIB_VERSION (F("1.0.3"))
#if defined (ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_LEONARDO) || defined(ARDUINO_AVR_MEGA2560)
@ -72,6 +72,11 @@ namespace std {
#if HAVE_STDCXX_CMATH || defined(_GLIBCXX_CMATH)
#include <cmath>
// substitute for std::sqrtf function, patch for issue #13
#undef sqrtf
namespace std {
inline float sqrtf(float n) { return __builtin_sqrtf(n); }
};
#else
#include <math.h>
// substitute for std::sqrt functions if not in your tool chain
@ -140,9 +145,9 @@ public:
void clear() {
_cnt = 0;
_sum = 0;
_min = 0;
_max = 0;
_sum = 0; // NaN;
_min = 0; // NaN;
_max = 0; // NaN;
_extra.clear();
// NOTE: _extra "guards" the conditional code e.g. ssqdiff
// NOTE: ssqdiff = not _ssq but sum of square differences
@ -229,9 +234,9 @@ public:
protected:
count_type _cnt { 0 };
value_type _sum { 0.0 };
value_type _min { 0.0 };
value_type _max { 0.0 };
value_type _sum { 0.0 }; // NaN;
value_type _min { 0.0 }; // NaN;
value_type _max { 0.0 }; // NaN;
// Conditionally compile to reduce dead code if not used

View File

@ -21,7 +21,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/Statistic.git"
},
"version": "1.0.2",
"version": "1.0.3",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=Statistic
version=1.0.2
version=1.0.3
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library with basic statistical functions for Arduino.