math.h File
C++ header file with declarations for the µTest++ mathematical utilities. More...
Included Headers
Namespaces Index
| namespace | micro_os_plus |
|
The primary namespace for the µOS++ framework. More... | |
| namespace | micro_test_plus |
|
Primary namespace for the µTest++ testing framework. More... | |
| namespace | detail |
|
Internal implementation details for the µTest++ framework. More... | |
| namespace | math |
|
Internal mathematical utilities for the µTest++ testing framework. More... | |
Functions Index
template <class T> | |
| constexpr T | abs (const T t) noexcept |
|
Computes the absolute value of a given comparable value. More... | |
template <class T> | |
| constexpr const T & | min_value (const T &lhs, const T &rhs) noexcept |
|
Computes the minimum of two comparable values. More... | |
Description
C++ header file with declarations for the µTest++ mathematical utilities.
This header provides the declaration of the mathematical utility template used within the µTest++ framework: the absolute value, used by the approximate comparison; and, only if the deprecated functionality is enabled, the minimum value, used by the tolerance of the deprecated wrappers. The exponentiation and the compile-time parsing of the numeric literals, which serve only the deprecated wrappers and literals, are declared in deprecated.h.
These utilities are lightweight, constexpr, and support both integral and floating-point types.
All definitions reside within the micro_os_plus::micro_test_plus::detail::math namespace, since they are implementation details of the comparisons, not part of the public API.
This file is included by micro-os-plus/micro-test-plus.h, which is the header that the applications include.
Functions
abs()
| nodiscard constexpr noexcept |
Computes the absolute value of a given comparable value.
This function template provides a generic, constexpr implementation for obtaining the absolute value of any type that supports comparison and unary negation.
The function returns the non-negative value of the input. If the input is less than the default-constructed value of its type (typically zero), the negated value is returned; otherwise, the original value is returned.
- Template Parameters
-
T The type of the input value. Must support comparison and unary negation.
- Parameters
-
t The value for which the absolute value is to be computed.
- Returns
The absolute value of the input.
Definition at line 88 of file math-inlines.h.
Reference micro_os_plus::micro_test_plus::detail::math::abs.
Referenced by micro_os_plus::micro_test_plus::detail::math::abs, micro_os_plus::micro_test_plus::detail::math::count_decimals, micro_os_plus::micro_test_plus::detail::differ_by_at_most and micro_os_plus::micro_test_plus::detail::within_tolerance.
min_value()
| nodiscard constexpr noexcept |
Computes the minimum of two comparable values.
This function template provides a generic, constexpr implementation for determining the minimum of two values of any type that supports comparison.
The function returns a reference to the lesser of the two input values, as determined by the < operator. If the second argument is less than the first, it is returned; otherwise, the first argument is returned.
- Template Parameters
-
T The type of the input values. Must support comparison via the < operator.
- Parameters
-
lhs The first value to compare.
rhs The second value to compare.
- Returns
A reference to the minimum of the two input values.
Definition at line 106 of file math-inlines.h.
Reference micro_os_plus::micro_test_plus::detail::math::min_value.
Referenced by micro_os_plus::micro_test_plus::detail::math::count_decimals, micro_os_plus::micro_test_plus::detail::math::min_value and micro_os_plus::micro_test_plus::detail::within_tolerance.
File Listing
The file content with the documentation metadata removed is:
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.