Floating point comparison in STL, BOOST
Posted
by Paul
on Stack Overflow
See other posts from Stack Overflow
or by Paul
Published on 2010-05-14T09:42:37Z
Indexed on
2010/05/14
9:44 UTC
Read the original article
Hit count: 242
Is there in the STL or in Boost a set of generic simple comparison functions?
The one I found are always requiring template parameters, and/or instantiation of a struct template.
I'm looking for something with a syntax like :
if ( is_greater(x,y) )
{
...
}
Which could be implemented as :
template <typename T>
bool is_greater(const T& x, const T& y)
{
return x > y + Precision<T>::eps;
}
© Stack Overflow or respective owner