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
| Parameter | Type | Nullable | Description |
|---|---|---|---|
a | Number | False | The first numeric value. |
b | Number | False | The second numeric value. |
relativeTolerance | Number | True | The maximum difference relative to the larger magnitude of a and b. Defaults to 1e-09. |
absoluteTolerance | Number | True | The 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