---------------------------------------- > Date: Tue, 28 May 2013 01:39:09 -0700 > Subject: Re: Short-circuit Logic > From: abdulsh...@gmail.com [...] >> What Steven wrote is entirely correct: sys.float_info.epsilon is the >> >> smallest value x such that 1.0 and 1.0+x have distinct floating-point >> >> representations. It has no relevance for comparing to zero. > > He just said that the way to test for zero equality is x == 0, and I meant > that this is true for integers but not necessarily for floats. And that's not > specific to Python.
Have you read [1]? There's a section "Infernal Zero" that discuss this problem. I think it's very interesting to know! ;) Just my 49.99999999999998ยข! lol [1] http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ -- http://mail.python.org/mailman/listinfo/python-list