[#BloombergLP-bdlb-DoubleCompareUtil-fuzzyCompare-0b] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/DoubleCompareUtil.adoc[DoubleCompareUtil]::fuzzyCompare :relfileprefix: ../../../ :mrdocs: `fuzzyCompare` overloads == Synopses Declared in `<bdlb_doublecompareutil.h>` Return `e_EQUAL` if the specified `a` and `b` have fuzzy equality, `e_GREATER_THAN` if `a > b`, `e_LESS_THAN` if `a < b`, and `e_NON_COMPARABLE` if either `a` or `b` are a NaN. Optionally specify the relative tolerance `relTol`, or `relTol` and the absolute tolerance `absTol`, used to determine fuzzy equality. If an optional tolerance argument is not specified, a reasonable (implementation‐dependent) default value for that tolerance is used. Fuzzy equality (denoted "a ~eq b") between a and b is defined in terms of the relative tolerance `relTol` and the absolute tolerance `absTol` such that the expression: ` a == b || fabs(a ‐ b) <= absTol || fabs(a ‐ b) / fabs((a + b) / 2.0) <= relTol ` is `true`; however, in the special case where `a != 0 && a == ‐b` is `true`, the actual relative difference is effectively infinite, and no value of `relTol` can imply fuzzy equality (although a sufficiently large value of `absTol` can). Note that if either `absTol` or `relTol` is 0.0, that aspect of fuzzy comparison is effectively suppressed, but the behavior of this function is defined. The behavior is undefined unless both 'relTol` and `absTol` are non‐negative, finite numbers (which excludes NaN and infinity). Note also that the primary purpose of this public static comparison method is to implement the six fuzzy equality and relational functions also defined within this utility `struct` (see `fuzzyEq`, `fuzzyNe`, `fuzzyLt`, `fuzzyLe`, `fuzzyGt`, and `fuzzyGe`). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdlb/DoubleCompareUtil/CompareResult.adoc[DoubleCompareUtil::CompareResult] xref:BloombergLP/bdlb/DoubleCompareUtil/fuzzyCompare-028.adoc[fuzzyCompare]( double a, double b); ---- [.small]#xref:BloombergLP/bdlb/DoubleCompareUtil/fuzzyCompare-028.adoc[_» more..._]# See the overload above for contract. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdlb/DoubleCompareUtil/CompareResult.adoc[DoubleCompareUtil::CompareResult] xref:BloombergLP/bdlb/DoubleCompareUtil/fuzzyCompare-02a.adoc[fuzzyCompare]( double a, double b, double relTol); ---- [.small]#xref:BloombergLP/bdlb/DoubleCompareUtil/fuzzyCompare-02a.adoc[_» more..._]# See the overload above for contract. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdlb/DoubleCompareUtil/CompareResult.adoc[CompareResult] xref:BloombergLP/bdlb/DoubleCompareUtil/fuzzyCompare-0f.adoc[fuzzyCompare]( double a, double b, double relTol, double absTol); ---- [.small]#xref:BloombergLP/bdlb/DoubleCompareUtil/fuzzyCompare-0f.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#