bundles / numpy latest / numpy / testing / _private / utils / nulp_diff
function
numpy.testing._private.utils:nulp_diff
source: build-install/usr/lib/python3.14/site-packages/numpy/testing/_private/utils.py :1888
Signature
def nulp_diff ( x , y , dtype = None ) Summary
For each item in x and y, return the number of representable floating points between them.
Parameters
x: array_likefirst input array
y: array_likesecond input array
dtype: dtype, optionalData-type to convert
xandyto if given. Default is None.
Returns
nulp: array_likenumber of representable floating point numbers between each item in x and y.
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
# By definition, epsilon is the smallest number such as 1 + eps != 1, so # there should be exactly one ULP between 1 and 1 + epsnulp_diff(1, 1 + np.finfo(x.dtype).eps)
Aliases
-
numpy.testing._private.utils.nulp_diff