DoubleToleranceExtension extension

Extension on double to support isWithinTolerance and isCloseTo

on

Methods

isCloseTo(double other, {double relativeTolerance = 1e-9, double absoluteTolerance = 1e-12}) bool

Available on double, provided by the DoubleToleranceExtension extension

Checks if this double is close to the other double, considering floating-point inaccuracies.
isWithinTolerance(double target, double tolerance) bool

Available on double, provided by the DoubleToleranceExtension extension

Checks if this double is within a fixed tolerance of the target value.