I don't know of any library that does it, perhaps because it is as simple as a one-liner or perhaps because it was forgotten...
As generality goes though, are you sure you'd like to set up the epsilon for one given type at a given value... throughout the application ? Personally I'd like to customize it depending on the operations I am doing (even though a default would be nice).
As for your operators, why not devising them yourself ?
template <class T>
bool rough_eq(T lhs, T rhs, T epsilon = Precision<T>::epsilon) // operator==
{
return fabs(lhs - rhs) < epsilon;
}
template <class T>
bool rough_lt(T lhs, T rhs, T epsilon = Precision<T>::epsilon) // operator<
{
return rhs - lhs >= epsilon;
// tricky >= because if the difference is equal to epsilon
// then they are not equal per the rough_eq method
}
template <class T>
bool rough_lte(T lhs, T rhs, T epsilon = Precision<T>::epsilon) // operator<=
{
return rhs - lhs > -epsilon;
}
The inequality and greater than methods can be trivially derived from this.
The additional parameter means that you may wish to specify another value for a given set of computations... an application-wide setting is too strict.