dtype_tol

odl.util.testutils.dtype_tol(dtype, default=None)[source]

Return a tolerance for a given dtype.

This is intended as a somewhat generous default (relative) tolerance for results of more or less stable computations.

Returned numbers:

  • np.float16: 1e-1

  • np.float32 or np.complex64: 1e-3

  • Others: default if given, otherwise 1e-5

See also

dtype_ndigits

Same tolerance expressed in number of digits.