>From a numerical standpoint, floats shouldn't generally be compared using equality. I came across a bug at work yesterday where I had written: if not delta: return 0.0 where delta was a floating point number. After a series of calculations piling up round-off error delta took on a value on the order of 1e-8. Not zero, but it should have been. The fix was easy enough: if abs(delta) < EPSILON: return 0.0 for a suitable value of EPSILON. That got me to thinking... I'm sure I have plenty of other similar mistakes in my code. (Never was much of a numerical analysis guy...) What if there was a picky-float setting that generated warnings if you compared two floats using "==" (or implicitly using "not")? Does that make sense to try for testing purposes? The implementation seemed straightforward enough: http://python.org/sf/1478364 I'm sure at the very least the idea needs more thought than I've given it. It's just a half-baked idea at this point. Skip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4