dtype_ndigits

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

Return the number of correct digits expected for a given dtype.

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

Returned numbers:

  • np.float16: 1

  • np.float32 or np.complex64: 3

  • Others: default if given, otherwise 5

See also

dtype_tol

Same precision expressed as tolerance