complex - unexpected behavior

Terry Reedy tjreedy at
Sun Aug 31 01:26:24 CEST 2003

"Mirek Rusin" <psyche at> wrote in message
news:bir1nb$o2$1 at
> ...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

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