3 ms·
This[0] is an example of how it's usually done. It might not be "efficient," as a == comparison perhaps, but it's more correct regardless. With FPs in computati
by noobermin 11y ago
This[0] is an example of how it's usually done. It might not be "efficient," as a == comparison perhaps, but it's more correct regardless. With FPs in computational stuff, there is usually an associated scale with a calculation, so you use that scale (rtol=0, atol=scale). Other times, it makes sense for something like
abs(a-b)/(avg(abs(a),abs(b)).
[0] http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.isclose.html http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/n...
- maxxxxx 11y agoAre there any built-in functions that do floating point comparisons with rounding? Calling abs many times seems incredibly inefficient.