Tolerance.is_zero

Tolerance.is_zero(a, tol=None)[source]

Check if a value is close enough to zero to be considered zero.

Parameters:
afloat

The value.

tolfloat, optional

The absolute tolerance. Default is None, in which case self.absolute is used.

Returns:
bool

True if the value is small enough to be considered zero. False otherwise.

Examples

>>> tol = Tolerance()
>>> tol.is_zero(1e-10)
True
>>> tol.is_zero(1e-05)
False