Autoware.Auto
autoware::common::helper_functions::comparisons Namespace Reference

## Functions

template<typename T >
types::bool8_t exclusive_or (const T &a, const T &b)
Convenience method for performing logical exclusive or ops. More...

template<typename T >
bool abs_eq (const T &a, const T &b, const T &eps)
Check for approximate equality in absolute terms. More...

template<typename T >
bool abs_lt (const T &a, const T &b, const T &eps)
Check for approximate less than in absolute terms. More...

template<typename T >
bool abs_lte (const T &a, const T &b, const T &eps)
Check for approximate less than or equal in absolute terms. More...

template<typename T >
bool abs_gte (const T &a, const T &b, const T &eps)
Check for approximate greater than or equal in absolute terms. More...

template<typename T >
bool abs_gt (const T &a, const T &b, const T &eps)
Check for approximate greater than in absolute terms. More...

template<typename T >
bool abs_eq_zero (const T &a, const T &eps)
Check whether a value is within epsilon of zero. More...

template<typename T >
bool rel_eq (const T &a, const T &b, const T &rel_eps)
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ More...

template<typename T >
bool approx_eq (const T &a, const T &b, const T &abs_eps, const T &rel_eps)
Check for approximate equality in absolute and relative terms. More...

## ◆ abs_eq()

template<typename T >
 bool autoware::common::helper_functions::comparisons::abs_eq ( const T & a, const T & b, const T & eps )

Check for approximate equality in absolute terms.

Precondition
eps >= 0
Returns
True iff 'a' and 'b' are within 'eps' of each other.

## ◆ abs_eq_zero()

template<typename T >
 bool autoware::common::helper_functions::comparisons::abs_eq_zero ( const T & a, const T & eps )

Check whether a value is within epsilon of zero.

Precondition
eps >= 0
Returns
True iff 'a' is within 'eps' of zero.

## ◆ abs_gt()

template<typename T >
 bool autoware::common::helper_functions::comparisons::abs_gt ( const T & a, const T & b, const T & eps )

Check for approximate greater than in absolute terms.

Precondition
eps >= 0
Returns
True iff 'a' is greater than 'b' minus 'eps'.

## ◆ abs_gte()

template<typename T >
 bool autoware::common::helper_functions::comparisons::abs_gte ( const T & a, const T & b, const T & eps )

Check for approximate greater than or equal in absolute terms.

Precondition
eps >= 0
Returns
True iff 'a' is greater than or equal to 'b' minus 'eps'.

## ◆ abs_lt()

template<typename T >
 bool autoware::common::helper_functions::comparisons::abs_lt ( const T & a, const T & b, const T & eps )

Check for approximate less than in absolute terms.

Precondition
eps >= 0
Returns
True iff 'a' is less than 'b' minus 'eps'.

## ◆ abs_lte()

template<typename T >
 bool autoware::common::helper_functions::comparisons::abs_lte ( const T & a, const T & b, const T & eps )

Check for approximate less than or equal in absolute terms.

Precondition
eps >= 0
Returns
True iff 'a' is less than or equal to 'b' plus 'eps'.

## ◆ approx_eq()

template<typename T >
 bool autoware::common::helper_functions::comparisons::approx_eq ( const T & a, const T & b, const T & abs_eps, const T & rel_eps )

Check for approximate equality in absolute and relative terms.

Note
This method should be used only if an explicit relative or absolute comparison is not appropriate for the particular use case.
Precondition
abs_eps >= 0
rel_eps >= 0
Returns
True iff 'a' and 'b' are within 'eps' or 'rel_eps' of each other

## ◆ exclusive_or()

template<typename T >
 types::bool8_t autoware::common::helper_functions::comparisons::exclusive_or ( const T & a, const T & b )

Convenience method for performing logical exclusive or ops.

Returns
True iff exactly one of 'a' and 'b' is true.

## ◆ rel_eq()

template<typename T >
 bool autoware::common::helper_functions::comparisons::rel_eq ( const T & a, const T & b, const T & rel_eps )
Precondition
rel_eps >= 0
Returns
True iff 'a' and 'b' are within relative 'rel_eps' of each other.