Volume Cartographer 2.27.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Namespaces | Functions | Variables
FloatComparison.hpp File Reference

Methods for comparing floating point numbers. More...

#include <algorithm>
#include <cmath>
#include <limits>
#include <type_traits>
Include dependency graph for FloatComparison.hpp:

Go to the source code of this file.

Namespaces

namespace  volcart
 Volume Cartographer library
 

Functions

template<typename T , std::enable_if_t< std::is_floating_point< T >::value, bool > = true>
auto volcart::AlmostEqual (const T lhs, const T rhs, T epsAbs=static_cast< T >(DEFAULT_MAX_DIFFERENCE), T epsRel=std::numeric_limits< T >::epsilon()) -> bool
 Compare if two floating-point numbers are "almost equal". More...
 

Variables

static constexpr double volcart::DEFAULT_MAX_DIFFERENCE = 1e-7
 

Detailed Description

Methods for comparing floating point numbers.

Author
Seth Parker
Date
November 2016

Provides templated methods for floating-point comparison. Based off the algorithms described by Bruce Dawson.

Definition in file FloatComparison.hpp.