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)
  2. bool approxEqual(D1 x, D2 y, D3 maxRelDiff)
    bool
    approxEqual
    (
    D1
    D2
    D3
    )
    (
    auto const ref D1 x
    ,
    auto const ref D2 y
    ,
    auto const ref D3 maxRelDiff
    )
    if (
    isDecimal!(D1, D2, D3)
    )
  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)

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