From: tim_one at email.msn.com (Tim Peters)
Date: Sun, 25 Apr 1999 15:00:03 -0400
Subject: possible bug in 1.5.1
In-Reply-To: <37234712.2E95BC37@stat.ubc.ca>
Message-ID: <000401be8f4d$d3ac70e0$d39e2299@tim>
X-UID: 1606                                                  

[Tim]
> ...
> What you can do is save away the attached as (e.g.) ieee.py, then
> in your code do
>
>    from ieee import PINF  # positive infinity, if it exists

Oops -- the attachment got lost due to a rounding error <wink>.  Here:

def _make_inf():
    x = 2.0
    x2 = x * x
    i = 0
    while i < 100 and x != x2:
        x = x2
        x2 = x * x
        i = i + 1
    if x != x2:
        raise ValueError("This machine's floats go on forever!")
    return x

PINF = _make_inf()
MINF = -PINF
NAN = PINF - PINF
if 1.0 + NAN == 1.0:
    raise ValueError("This machine doesn't have NaNs, "
                     "'overflows' to a finite number, "
                     "or is 754-conformant but is using "
                     "a goofy rounding mode.")
PZERO = 0.0
MZERO = -PZERO






