Loading...
Searching...
No Matches
Public Member Functions | List of all members
bitpit::utils::DoubleFloatingEqual Struct Reference

#include <commonUtils.hpp>

Inheritance diagram for bitpit::utils::DoubleFloatingEqual:
Inheritance graph
[legend]
Collaboration diagram for bitpit::utils::DoubleFloatingEqual:
Collaboration graph
[legend]

Public Member Functions

bool operator() (double x, double y, double relativeTolerance=DEFAULT_REL_TOL, double absoluteTolerance=DEFAULT_ABS_TOL) const
 

Additional Inherited Members

- Static Protected Attributes inherited from bitpit::utils::DoubleFloatingComparison
static constexpr const double DEFAULT_ABS_TOL = 10 * std::numeric_limits<double>::epsilon()
 
static constexpr const double DEFAULT_REL_TOL = 10 * std::numeric_limits<double>::epsilon()
 

Detailed Description

Functor to compare two double precision floating point numbers.

See chapter 4.2.2 equation 35 of "The art of computer programming (vol II)" Donald. E. Knuth, 1998, Addison-Wesley Longman, Inc., ISBN 0-201-89684-2, Addison-Wesley Professional; 3rd edition.

Also see: "https://www.boost.org/doc/libs/1_74_0/libs/test/doc/html/boost_test/testing_tools/extended_comparison/floating_point/floating_points_comparison_theory.html"

Examples
LA_example_00001.cpp.

Definition at line 160 of file commonUtils.hpp.

Member Function Documentation

◆ operator()()

bool bitpit::utils::DoubleFloatingEqual::operator() ( double x,
double y,
double relativeTolerance = DEFAULT_REL_TOL,
double absoluteTolerance = DEFAULT_ABS_TOL ) const
inline

Compares the specified double precision floating point numbers and returns true if the numbers match.

Parameters
xif the first value to compare
yif the second value to compare
relativeToleranceis the relative tolerance that will be used to perform the comparison
absoluteToleranceis the absolute tolerance that will be used to perform the comparison
Returns
Returns true if the numbers match, false otherwise.

Definition at line 174 of file commonUtils.hpp.


The documentation for this struct was generated from the following file:
--- layout: doxygen_footer ---