roundN Helper¶
-
template<size_t MaxDeps = 8, typename Source>
auto RxESP32::Helpers::Numerical::roundN(Source &source, const uint8_t decimals = 0, const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {})¶ Round signal value to N decimal places.
Creates a Computed that rounds source values to the specified number of decimals.
- Since
v0.1.0
Signal<float> value(3.14159); auto rounded2 = roundN(value, 2); // 3.14 auto rounded0 = roundN(value, 0); // 3.0Warning
Only accepts floating-point types (
float,double).
See Also¶
Numerical Helpers - Overview