isCloseRelative
isCloseRelative(
a,b,relTolerance):boolean
Defined in: packages/core/src/number/is-close-relative.ts:21
Tests whether two numbers are within a relative tolerance of each other: `|a
- B| <= relTolerance * max(|a|, |b|)`.
Scale-free, and therefore undefined at the origin — the bound collapses to
|a| <= relTolerance * |a|, false for every non-zero a. Nothing but 0 is
ever relatively close to 0. Use isCloseAbsolute for values that
straddle zero, or isCloseTo to combine the two.
No default: a relative tolerance is a claim about how much error the
computation that produced a and b may have accumulated, which only the
caller knows.
Parameters
Section titled “Parameters”number
The first number to compare.
number
The second number to compare.
relTolerance
Section titled “relTolerance”number
The relative tolerance.
Returns
Section titled “Returns”boolean
true if the numbers are close within the specified relative
tolerance, false otherwise.