Comparing floating point numbers with numpy and scipy

Is there an epsilon constant (like in Matlab) in numpy or scipy modules for comparing floating point numbers?

+3
python numpy scipy
source share
1 answer

You can use np.finfo

>>> import numpy as np >>> np.finfo(np.double).eps 2.2204460492503131e-16 >>> np.finfo(np.single).eps 1.1920929e-07 
+4
source share

All Articles