Skip to main content
Version: V3 (Ignition 8.3)

tamaki.mes.backup.compare.isClose

Description

Determines whether two numeric values are close to each other within a relative and/or absolute tolerance. Two values are considered close when their absolute difference is no greater than max(relativeTolerance * max(abs(a), abs(b)), absoluteTolerance). This mirrors Python's math.isclose and is used by equalValues.

Syntax

tamaki.mes.backup.compare.isClose(a, b, relativeTolerance=1e-09, absoluteTolerance=0.0)

Parameters

ParameterTypeNullableDescription
aNumberFalseThe first numeric value.
bNumberFalseThe second numeric value.
relativeToleranceNumberTrueThe maximum difference relative to the larger magnitude of a and b. Defaults to 1e-09.
absoluteToleranceNumberTrueThe maximum absolute difference (useful near zero). Defaults to 0.0.

Returns

A Boolean: True if a and b are within tolerance, otherwise False.

Code Examples

print(tamaki.mes.backup.compare.isClose(0.1 + 0.2, 0.3)) # True