approxEqual

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

  1. bool approxEqual(D1 x, D2 y, D3 maxRelDiff, D4 maxAbsDiff)
    bool
    approxEqual
    (
    D1
    D2
    D3
    D4
    )
    (
    auto const ref D1 x
    ,
    auto const ref D2 y
    ,
    auto const ref D3 maxRelDiff
    ,
    auto const ref D4 maxAbsDiff
    )
    if (
    isDecimal!(D1, D2, D3, D4)
    )
  2. bool approxEqual(D1 x, D2 y, D3 maxRelDiff)
  3. bool approxEqual(D1 x, D2 y)

Parameters

x D1

First item to compare

y D2

Second item to compare

maxRelDiff D3

Maximum allowable relative difference (defaults to 1e-5)

maxAbsDiff D4

Maximum allowable absolute difference (defaults to 1e-2)

Return Value

Type: bool

true if the two items are approximately equal under either criterium. Notes: This operation is silent, does not throw any exceptions and it doesn't set any error flags.

Meta