SignificantDigits Filter

template<typename T, size_t Digits>
struct SignificantDigits

Filter that rounds to specified significant digits before comparison.

This filter rounds both old and new values to the specified number of significant digits before comparing, propagating only when the rounded values differ.

Since

v0.1.0

// Example: Round to 3 significant digits before comparison
Signal<float, 10, SignificantDigits<float, 3>> sensor(0.0);

Warning

  • Only accepts floating-point types (float, double).

  • Digits must be greater than 0.

Template Parameters:
typename T

Floating-point type.

size_t Digits

Number of significant digits.

Public Functions

inline bool operator()(const T &old_value, const T &new_value) const

See Also