Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Header <boost/test/tools/floating_point_comparison.hpp>

algorithms for comparing floating point values

namespace boost {
  namespace math {
    namespace fpc {
      template<typename FPT> class close_at_tolerance;
      template<typename T> class is_abstract_class_or_function;

      template<typename FPT> struct percent_tolerance_t;

      template<typename FPT> class small_with_tolerance;

      template<typename T> struct tolerance_based;
      template<typename T, bool enabled> struct tolerance_based_delegate;

      template<typename T> struct tolerance_based_delegate<T, false>;
      template<typename T> struct tolerance_based_delegate<T, true>;

      // Method for comparing floating point numbers. 
      enum strength { FPC_STRONG, FPC_WEAK };
      template<typename FPT> 
        std::ostream & 
        operator<<(std::ostream & out, percent_tolerance_t< FPT > t);
      template<typename FPT> 
        percent_tolerance_t< FPT > percent_tolerance(FPT v);
      template<typename FPT> bool is_small(FPT fpv, FPT tolerance);