MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / count

Method count

libraries/DistanceTable/DistanceTable.cpp:194–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192
193
194uint16_t DistanceTable::count(float value, float epsilon)
195{
196 uint16_t cnt = 0;
197 for (uint16_t index = 0; index < _elements; index++)
198 {
199 float current = _distanceTable[index];
200 if (abs (current - value) < epsilon) cnt++;
201 else if (_invert)
202 {
203 if (abs (current + value) < epsilon) cnt++;
204 }
205 }
206 if (_invert) return cnt;
207 return cnt * 2; // count the symmetrical elements too.
208}
209
210
211uint16_t DistanceTable::countAbove(float value)

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36