absolute Helper

template<size_t MaxDeps = 8, typename Source>
auto RxESP32::Helpers::Numerical::absolute(Source &source, const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {})

Get absolute value of source.

Creates a Computed that returns the absolute value of the source.

Since

v0.1.0

Signal<int> value(-42);
auto abs_value = absolute(value);

Serial.println(abs_value.get());  // 42
value.set(10);
Serial.println(abs_value.get());  // 10

Warning

Only accepts arithmetic types (integral and floating-point).

Template Parameters:
size_t MaxDeps = 8

Maximum number of dependents for the computed signal.

Parameters:
Source &source

Source (determines result type).

const typename Computed<decltype(source.get()), 1, MaxDeps>::Options &options = {}

Optional Computed configuration.

Returns:

Computed with absolute values.

See Also