approxEqual

Computes whether two values are approximately equal, admitting a maximum relative difference, and a maximum absolute difference.

  1. bool approxEqual(T lhs, U rhs, V maxRelDiff, V maxAbsDiff = 1e-5)
    bool
    approxEqual
    (
    T
    U
    V
    )
    (
    T lhs
    ,
    U rhs
    ,,
    V maxAbsDiff = 1e-5
    )
  2. bool approxEqual(T lhs, U rhs)

Parameters

lhs
Type: T

First item to compare.

rhs
Type: U

Second item to compare.

maxRelDiff
Type: V

Maximum allowable difference relative to rhs.

maxAbsDiff
Type: V

Maximum absolute difference.

Return Value

Type: bool

true if the two items are approximately equal under either criterium. If one item is a range, and the other is a single value, then the result is the logical and-ing of calling approxEqual on each element of the ranged item against the single item. If both items are ranges, then approxEqual returns true if and only if the ranges have the same number of elements and if approxEqual evaluates to true for each pair of elements.

Meta