close

compas.geometry.close(value1, value2, tol=1e-05)[source]

Returns True if two values are equal within a tolerance.

Parameters:
value1float or int
value2float or int
tolfloat, optional

The absolute tolerance for comparing values. Default is TOL.absolute.

Returns:
bool

True if the values are closer than the tolerance. False otherwise.

Warning

Deprecated since version 2.0: Will be removed in 2.1 Use TOL.is_close() instead.

The tolerance value used by this function is an absolute tolerance. It is more accurate to use a combination of absolute and relative tolerance. Therefor, use TOL.is_close() instead.

Examples

>>> close(1., 1.001)
False
>>> close(1., 1.001, tol=1e-2)
True