PGROUTING  3.2
anonymous_namespace{xy_vertex.cpp} Namespace Reference

Functions

template<typename T >
std::enable_if<!std::numeric_limits< T >::is_integer, bool >::type almost_equal (T x, T y, int ulp)
 

Function Documentation

◆ almost_equal()

template<typename T >
std::enable_if<!std::numeric_limits<T>::is_integer, bool>::type anonymous_namespace{xy_vertex.cpp}::almost_equal ( x,
y,
int  ulp 
)

Definition at line 38 of file xy_vertex.cpp.

38  {
39  // the machine epsilon has to be scaled to the magnitude of the values used
40  // and multiplied by the desired precision in ULPs (units in the last place)
41  return std::abs(x-y) <= std::numeric_limits<T>::epsilon() * std::abs(x+y) * ulp
42  // unless the result is subnormal
43  || std::abs(x-y) < std::numeric_limits<T>::min();
44 }

Referenced by pgrouting::XY_vertex::operator==().