Machine Epsilon Python

Last Updated On Friday 5th Nov 2021

python eps

python machine epsilon.Get the machine epsilon for a given float type is to use np.finfo().machine precision python.

	class numpy.finfo(dtype)
	

numpy epsilon

Machine limits for floating point types.
Parameters : dtypefloat, dtype, or instance – Kind of floating point data-type about which to get information.

machine epsilon python

	print(np.finfo(float).eps)
# 2.22044604925e-16

print(np.finfo(np.float32).eps)
# 1.19209e-07
	
	float_epsilon = np.finfo(float).eps
print(float_epsilon)
	

OUTPUT – 2.220446049250313e-16

python machine precision

	float32_epsilon = np.finfo(np.float32).eps
print(float32_epsilon)
	

OUTPUT – 1.1920929e-07