cfdm.rtol¶

cfdm.
rtol
(*arg)[source]¶ The numerical equality tolerance on relative differences.
Two real numbers
x
andy
are considered equal ifxy<=atol+rtoly
, 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
>>> cfdm.rtol() <Constant: 2.220446049250313e16> >>> print(cfdm.rtol()) 2.220446049250313e16 >>> str(cfdm.rtol()) '2.220446049250313e16' >>> cfdm.rtol().value 2.220446049250313e16 >>> float(cfdm.rtol()) 2.220446049250313e16
>>> old = cfdm.rtol(1e10) >>> cfdm.rtol() <Constant: 2.220446049250313e16> >>> cfdm.rtol(old) <Constant: 1e10> >>> cfdm.rtol() <Constant: 2.220446049250313e16>
Use as a context manager:
>>> print(cfdm.rtol()) 2.220446049250313e16 >>> with cfdm.rtol(1e5): ... print(cfdm.rtol(), cfdm.rtol(2e30), cfdm.rtol()) ... 1e05 1e05 2e30 >>> print(cfdm.rtol()) 2.220446049250313e16