A C++ template library for embedded applications
MIT licensed
Join the ETL community
Designed and
maintained by
John Wellbelove
Like the ETL? Become a patron!


A template function that returns the absolute value.

The function has two variants; one for signed and one for unsigned types.
The unsigned variant merely returns the parameter value.
The variant is chosen at compile time according to the parameter type.
template <typename T>
T absolute(T value)

For C++11 and above
template <typename T>
constexpr T absolute(T value)