NCBI C++ ToolKit
Enumerations | Functions
floating_point.hpp File Reference
#include <corelib/ncbistl.hpp>
#include <corelib/ncbiexpt.hpp>
#include <util/impl/floating_point_comparison.hpp>
+ Include dependency graph for floating_point.hpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Enumerations

enum  EFloatingPointOperation { eFP_LessThan, eFP_EqualTo, eFP_GreaterThan }
 Floating point supported operations. More...
 
enum  EFloatingPointTolerance { eFP_WithFraction, eFP_WithPercent }
 Supported types of tolerances. More...
 

Functions

template<typename TFloatingPoint >
bool g_FloatingPoint_Compare (TFloatingPoint lhs, EFloatingPointOperation operation, TFloatingPoint rhs, EFloatingPointTolerance tolerance, TFloatingPoint threshold)
 Floating point comparisons. More...
 

Enumeration Type Documentation

Floating point supported operations.

Enumerator
eFP_LessThan 

'<' operation

eFP_EqualTo 

'==' operation

eFP_GreaterThan 

'>' operation

Definition at line 45 of file floating_point.hpp.

Supported types of tolerances.

Enumerator
eFP_WithFraction 

fraction tolerance

eFP_WithPercent 

percent tolerance

Definition at line 52 of file floating_point.hpp.

Function Documentation

template<typename TFloatingPoint >
bool g_FloatingPoint_Compare ( TFloatingPoint  lhs,
EFloatingPointOperation  operation,
TFloatingPoint  rhs,
EFloatingPointTolerance  tolerance,
TFloatingPoint  threshold 
)

Floating point comparisons.

It uses boost implementation of the comparison so the details are available here: http://www.boost.org/doc/libs/1_39_0/libs/test/doc/html/utf/testing-tools/floating_point_comparison.html

Parameters
lhsLeft hand side value to compare
operationRequired comparison
rhsRight hand side value to compare
toleranceTolerance type to be used
thresholdTolerance value
Returns
Evaluation of the required operation

Definition at line 77 of file floating_point.hpp.

References _TROUBLE, eFP_EqualTo, eFP_GreaterThan, eFP_LessThan, eFP_WithFraction, eFP_WithPercent, ncbi::boost_fp_impl::fraction_tolerance(), and ncbi::boost_fp_impl::percent_tolerance().

Modified on Mon Aug 31 16:59:19 2015 by modify_doxy.py rev. 426318