Question on using FP numbers in python 2

Chris Angelico rosuav at
Sat Feb 15 04:39:43 CET 2014

On Sat, Feb 15, 2014 at 2:25 PM, Gene Heskett <gheskett at> wrote:
> Is there something I can search for and fix in some python code that is
> giving me bogus answers that get good only when there is a valid digit to
> the left of the decimal point?

Interesting. I'd look for anything that mixes very large and very
small numbers, first off. Otherwise, just follow the standard
debugging technique of stripping code out of your program and seeing
if the problem's still there. Continue until you have the barest
minimum, and hope hope hope that it's a Bohr bug and not a Heisenbug!

If it really is a floating point issue, you probably don't have to
worry about, for instance, a segfault that happens when a garbage
collection run occurs between this statement and that statement...
yes, I've had to deal with that sort of thing! (Turned out to be a
refcount bug in C code. When the gc ran, something got disposed of
that shouldn't have.)


More information about the Python-list mailing list