pydsm.relab.eps

pydsm.relab.eps(x=1.0)

Provide floating point relative accuracy

This function tries to replicate the eps interface of Matlab.

Parameters:
xfloat or array_like or numeric type
Returns:
dfloat or array_like

If x is a float, the positive distance from abs(x) to the next larger in magnitude floating point number of the same precision as x.

If x is an array, operation is elementwise.

If x is a numeric type, operation is for 1.0 in that numeric type.

Examples

>>> print(eps())
2.220446049250313e-16
>>> print(eps(1/2))
1.1102230246251565e-16
>>> print(eps(np.float32))
1.1920929e-07