isWithinTolerance method
Checks if this integer is within a fixed tolerance of the target value.
Formula: (this - target).abs() <= tolerance.
Assumes tolerance is a non-negative integer.
Implementation
bool isWithinTolerance(int target, int tolerance) {
assert(tolerance >= 0, 'Tolerance cannot be negative');
return (this - target).abs() <= tolerance;
}