cf.atol¶
-
cf.
atol
(*arg)[source]¶ The tolerance on absolute differences when testing for numerically tolerant equality.
Two real numbers
x
andy
are 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 ofatol
andrtol
are initialised to the system epsilon (the difference between 1 and the least value greater than 1 that is representable as a float).New in version (cfdm): 1.7.0
See also
- Parameters
- Returns
Constant
The value prior to the change, or the current value if no new value was specified.
Examples:
>>> cf.atol() <CF Constant: 2.220446049250313e-16> >>> print(cf.atol()) 2.220446049250313e-16 >>> str(cf.atol()) '2.220446049250313e-16' >>> cf.atol().value 2.220446049250313e-16 >>> float(cf.atol()) 2.220446049250313e-16
>>> old = cf.atol(1e-10) >>> cf.atol() <CF Constant: 2.220446049250313e-16> >>> cf.atol(old) <CF Constant: 1e-10> >>> cf.atol() <CF Constant: 2.220446049250313e-16>
Use as a context manager:
>>> print(cf.atol()) 2.220446049250313e-16 >>> with cf.atol(1e-5): ... print(cf.atol(), cf.atol(2e-30), cf.atol()) ... 1e-05 1e-05 2e-30 >>> print(cf.atol()) 2.220446049250313e-16