42template <
typename T>
bool IsWithinWrapped( T aValue, T aNominal, T aWrap, T aError )
44 double diff = std::fmod( aNominal - aValue + aWrap / 2.0, aWrap );
49 return diff - aWrap / 2.0 <= aError;
57template <
typename T>
bool IsWithin( T aValue, T aNominal, T aError )
59 return ( aValue >= aNominal - aError ) && ( aValue <= aNominal + aError );
68template <
typename T>
bool IsWithinBounds( T aValue, T aNominal, T aErrorAbove, T aErrorBelow )
70 return ( aValue >= aNominal - aErrorBelow ) && ( aValue <= aNominal + aErrorAbove );
bool IsWithinWrapped(T aValue, T aNominal, T aWrap, T aError)
Check if a value is within a tolerance of a nominal value, wrapping to a given val.
bool IsWithin(T aValue, T aNominal, T aError)
Check if a value is within a tolerance of a nominal value.
bool IsWithinAndAbove(T aValue, T aNominal, T aErrorAbove)
value is in range [aNominal, aNominal + aErrorAbove]
bool IsWithinAndBelow(T aValue, T aNominal, T aErrorBelow)
value is in range [aNominal - aErrorBelow, aNominal]
bool IsWithinBounds(T aValue, T aNominal, T aErrorAbove, T aErrorBelow)
Check if a value is within a tolerance of a nominal value, with different allowances for errors above...