Tolerance.precision_from_tolerance

Tolerance.precision_from_tolerance(tol=None)[source]

Compute the precision from a given tolerance.

Parameters:
tolfloat, optional

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

Returns:
int

The precision.

Examples

>>> tol = Tolerance()
>>> tol.precision_from_tolerance(1e-07)
7
>>> tol.precision_from_tolerance(1e-05)
5
>>> tol.precision_from_tolerance(1e-03)
3
>>> tol.precision_from_tolerance(1e-01)
1