◐ Shell
clean mode source ↗

Message 76890 - Python tracker

Mark> If you have time, could you try the attached patch and report what
    Mark> gets printed when cmath.exp(710+1.5j) is called?  On my machine, I
    Mark> get:
    ...

Looks similar here:

    % ./python
    Python 3.0 (r30:67503, Dec  3 2008, 14:46:39)
    [GCC 4.2.2] on sunos5
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cmath
    >>> cmath.exp(complex(710.0, 1.5))
    r.real, r.imag: 1.58027e+307, Inf
    Py_IS_INFINITY(r.real), Py_IS_INFINITY(r.imag): 0, 1
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OverflowError: math range error

If I then comment back out your two printf statements and recompile, it once
again fails to raise OverflowError:

    % ./python
    Python 3.0 (r30:67503, Dec  3 2008, 14:46:39)
    [GCC 4.2.2] on sunos5
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import cmath ; cmath.exp(complex(710.0, 1.5))
    (1.5802653829857376e+307+inf*j)

Very weird.  If I uncomment either of your printf statements OverflowError
seems to be raised as expected.  It's as if some register bit isn't being
set unless you reference r.real or r.imag multiple times.

Skip