bundles / numpy 2.4.4 / numpy / testing / _private / utils / assert_array_max_ulp
function
numpy.testing._private.utils:assert_array_max_ulp
Signature
def assert_array_max_ulp ( a , b , maxulp = 1 , dtype = None ) Summary
Check that all items of arrays differ in at most N Units in the Last Place.
Parameters
a, b: array_likeInput arrays to be compared.
maxulp: int, optionalThe maximum number of units in the last place that elements of
aandbcan differ. Default is 1.dtype: dtype, optionalData-type to convert
aandbto if given. Default is None.
Returns
ret: ndarrayArray containing number of representable floating point numbers between items in
aandb.
Raises
: AssertionErrorIf one or more elements differ by more than
maxulp.
Notes
For computing the ULP difference, this API does not differentiate between various representations of NAN (ULP difference between 0x7fc00000 and 0xffc00000 is zero).
Examples
a = np.linspace(0., 1., 100) res = np.testing.assert_array_max_ulp(a, np.arcsin(np.sin(a)))
See also
- assert_array_almost_equal_nulp
Compare two arrays relatively to their spacing.
Aliases
-
numpy.testing.assert_array_max_ulp