close

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

Returns True if two values are equal within a tolerance.

Parameters
  • value1 (float or int)

  • value2 (float or int)

  • tol (float, optional) – The tolerance for comparing values.

Returns

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

Examples

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