complex - unexpected behavior

Terry Reedy tjreedy at udel.edu
Sat Aug 30 19:26:24 EDT 2003


"Mirek Rusin" <psyche at mensa.org.pl> wrote in message
news:bir1nb$o2$1 at atlantis.news.tpi.pl...
>
> ...i've got different results on linux / windows box
> with complex nums, why?

Floating point behaviour in detail and in corner cases in general and
NaN versus overflow in particular is C compiler dependent.  Says so
somewhere in manual (and previous postings on clpy.  In other words,
this is one area where Python does not shield you from unnecessary
variation in C compiler behavior and standards that do not
standardize.

Terry J. Reedy

>  linux:
> >>> print (2.83527944266e+184-3.10413674648e+186j) ** 2
> (nan+nanj)
> ...m$ win:
> >>> print (2.83527944266e+184-3.10413674648e+186j) ** 2
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> OverflowError: complex exponentiaion






More information about the Python-list mailing list