numpy.spacing(x,/,out=None,*,where=True,casting='same_kind',order='K',dtype=None,subok=True[,signature,extobj]) = <ufunc 'spacing'>¶Return the distance between x and the nearest adjacent number.
| Parameters: |
|
|---|---|
| Returns: |
|
Notes
It can be considered as a generalization of EPS:spacing(np.float64(1))==np.finfo(np.float64).eps, and thereshould not be any representable number betweenx+spacing(x) andx for any finite x.
Spacing of +- inf and NaN is NaN.
Examples
>>>np.spacing(1)==np.finfo(np.float64).epsTrue