cfdm.atol¶
- cfdm.atol(*arg)[source]¶
The numerical equality tolerance on absolute differences.
Two real numbers
xandyare considered equal if|x-y|<=atol+rtol|y|, whereatol(the tolerance on absolute differences) andrtol(the tolerance on relative differences) are positive, typically very small numbers. The values ofatolandrtolare initialised to the system epsilon (the difference between 1 and the least value greater than 1 that is representable as a float).Added in version (cfdm): 1.7.0
See also
- Parameters:
- Returns:
ConstantThe value prior to the change, or the current value if no new value was specified.
Examples
>>> cfdm.atol() <Constant: 2.220446049250313e-16> >>> print(cfdm.atol()) 2.220446049250313e-16 >>> str(cfdm.atol()) '2.220446049250313e-16' >>> cfdm.atol().value 2.220446049250313e-16 >>> float(cfdm.atol()) 2.220446049250313e-16
>>> old = cfdm.atol(1e-10) >>> cfdm.atol() <Constant: 1e-10> >>> cfdm.atol(old) <Constant: 1e-10> >>> cfdm.atol() <Constant: 2.220446049250313e-16>
Use as a context manager:
>>> print(cfdm.atol()) 2.220446049250313e-16 >>> with cfdm.atol(1e-5): ... print(cfdm.atol(), cfdm.atol(2e-30), cfdm.atol()) ... 1e-05 1e-05 2e-30 >>> print(cfdm.atol()) 2.220446049250313e-16