etl/docs/maths/absolute.md
2026-04-15 13:02:52 +02:00

615 B

title
absolute

A template functions that return the absolute value.

template <typename T>
ETL_CONSTEXPR T absolute(T value)

Return
The absolute of value.

If T is int8_t:- 0 => 0 127 => 127 -127 => 127

Error Asserts if value == etl::integral_limits<T>::min.


template <typename T>
ETL_CONSTEXPR etl::make_unsigned_t<T> absolute_unsigned(T value)

Return
The absolute of value, cast to the unsigned version of type T.

If T is int8_t:-

Return type is etl::make_unsigned_t<T> 0 => 0 127 => 127 -127 => 127 -128 => 128