[Biopython-dev] float('inf') or float('-inf')

Peter Cock p.j.a.cock at googlemail.com
Thu Jun 16 18:44:48 UTC 2011


On Sun, Jun 5, 2011 at 10:51 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> Hi all,
>
> As explained in PEP 754, prior to Python 2.6 float('inf'), float('-inf')
> and also float('nan') were passed to the underlying C library, which
> may or may not return the IEEE special floating point value for
> infinity, minus infinity or nan. See:
> http://www.python.org/dev/peps/pep-0754/
>
> This is the root cause of this unit test failure on Windows Python 2.5,
> http://testing.open-bio.org/biopython/builders/Windows%20XP%20-%20Python%202.5/builds/224/steps/shell/logs/stdio
> ...
>
> Based on the PEP 754 example, 1E400 may work instead:
>
> try:
>    neg_inf = float("-inf")
> except ValueError:
>    neg_inf =  -1E400
>
> I'll try to test this on the machine later in the week when I get
> a chance. If anyone else has Python 2.4 or 2.5 on Windows
> and wants to look at this now, please go ahead.

Committed now, after testing locally:
https://github.com/biopython/biopython/commit/60f28efdfe19fdcb2bb3ca4dc2ca6a222be97394

Peter




More information about the Biopython-dev mailing list