micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::math Namespace Reference

Local mathematical functions. More...

Functions

template<class T >
constexpr auto abs (const T t) -> T
 Generic absolute of any value.
 
template<class T , char... Cs>
constexpr auto den () -> T
 Compute the decimals of a number represented as an array of characters.
 
template<class T , char... Cs>
constexpr auto den_size () -> T
 Compute the number of decimal places of a number represented as an array of characters.
 
template<class T , class Value_T >
constexpr auto den_size (Value_T value) -> T
 Compute the number of decimal places of a value, up to 7 digits.
 
template<class T >
constexpr auto min_value (const T &lhs, const T &rhs) -> const T &
 Generic minimum of two values.
 
template<class T , char... Cs>
constexpr auto num () -> T
 Compute the integral value of a number represented as an array of characters.
 
template<class T , class Exp_T >
constexpr auto pow (const T base, const Exp_T exp) -> T
 Generic 'power of', to raise base to exponent (base ^ exp).
 

Detailed Description

Local mathematical functions.

Some may have equivalents in the standard library, but may be more complicated to use, or have only floating point variants, or not be constexpr.

Function Documentation

◆ abs()

template<class T >
constexpr auto micro_os_plus::micro_test_plus::math::abs ( const T t) -> T
constexpr

Generic absolute of any value.

Definition at line 56 of file math.h.

◆ den()

template<class T , char... Cs>
constexpr auto micro_os_plus::micro_test_plus::math::den ( ) -> T
constexpr

Compute the decimals of a number represented as an array of characters.

Definition at line 114 of file math.h.

◆ den_size() [1/2]

template<class T , char... Cs>
constexpr auto micro_os_plus::micro_test_plus::math::den_size ( ) -> T
constexpr

Compute the number of decimal places of a number represented as an array of characters.

Definition at line 136 of file math.h.

◆ den_size() [2/2]

template<class T , class Value_T >
constexpr auto micro_os_plus::micro_test_plus::math::den_size ( Value_T value) -> T
constexpr

Compute the number of decimal places of a value, up to 7 digits.

Definition at line 160 of file math.h.

◆ min_value()

template<class T >
constexpr auto micro_os_plus::micro_test_plus::math::min_value ( const T & lhs,
const T & rhs ) -> const T&
constexpr

Generic minimum of two values.

Definition at line 66 of file math.h.

◆ num()

template<class T , char... Cs>
constexpr auto micro_os_plus::micro_test_plus::math::num ( ) -> T
constexpr

Compute the integral value of a number represented as an array of characters.

Definition at line 88 of file math.h.

◆ pow()

template<class T , class Exp_T >
constexpr auto micro_os_plus::micro_test_plus::math::pow ( const T base,
const Exp_T exp ) -> T
constexpr

Generic 'power of', to raise base to exponent (base ^ exp).

Definition at line 76 of file math.h.