SA_Maths
Sapphire Suite's C++ Maths Library
Loading...
Searching...
No Matches
Functions
Equals.hpp File Reference

Equals method implementation. More...

#include <limits>

Go to the source code of this file.

Functions

template<typename T , typename EpsT = T>
constexpr bool SA::Maths::Equals (const T &_lhs, const T &_rhs, EpsT _epsilon=std::numeric_limits< EpsT >::epsilon())
 Compare two T objects.
 
template<typename T , typename EpsT = T>
constexpr bool SA::Maths::Equals0 (T _in, EpsT _epsilon=std::numeric_limits< EpsT >::epsilon()) noexcept
 Compare one T to T(0).
 
template<typename T , typename EpsT = T>
constexpr bool SA::Maths::Equals1 (T _in, EpsT _epsilon=std::numeric_limits< EpsT >::epsilon()) noexcept
 Compare one T to T(1).
 

Detailed Description

Equals method implementation.

Function Documentation

◆ Equals()

template<typename T , typename EpsT = T>
constexpr bool SA::Maths::Equals ( const T & _lhs,
const T & _rhs,
EpsT _epsilon = std::numeric_limits<EpsT>::epsilon() )
constexpr

Compare two T objects.

Template Parameters
TType of operands.
EpsTType of epsilon.
Parameters
[in]_lhsLeft hand side operand to compare.
[in]_rhsRight hand side operand to compare.
[in]_epsilonEpsilon value for threshold compare.
Returns
True on equality, otherwise false.

◆ Equals0()

template<typename T , typename EpsT = T>
constexpr bool SA::Maths::Equals0 ( T _in,
EpsT _epsilon = std::numeric_limits<EpsT>::epsilon() )
constexprnoexcept

Compare one T to T(0).

Template Parameters
TType of input.
EpsTType of epsilon.
Parameters
[in]_inOperand to compare to 0.
[in]_epsilonAllowed threshold to accept equality.
Returns
Whether _in is equal to 0.

◆ Equals1()

template<typename T , typename EpsT = T>
constexpr bool SA::Maths::Equals1 ( T _in,
EpsT _epsilon = std::numeric_limits<EpsT>::epsilon() )
constexprnoexcept

Compare one T to T(1).

Template Parameters
TType of input.
EpsTType of epsilon.
Parameters
[in]_inOperand to compare to 1.
[in]_epsilonAllowed threshold to accept equality.
Returns
Whether _in is equal to 1.