[Numpy-discussion] Recent work for branch cuts / C99 complex maths: problems on mingw

Pauli Virtanen pav@iki...
Tue Jul 29 06:59:52 CDT 2008

Tue, 29 Jul 2008 20:16:36 +0900, David Cournapeau wrote:
> Is there a clear explanation about C99 features related to complex math
> somewhere ? The problem with C99 is that few compilers implement it

The C99 standard (or more precisely its draft but this is probably mostly 
the same thing) can be found here:


> properly. None of the most used compilers implement it entirely, and
> some of them don't even try, like MS compilers; the windows situations
> is the most problematic because the mingw32 compilers are old, and thus
> may not handle than many C99 features. There are also some shortcuts in
> the way we detect the math functions, which is not 100 % reliable
> (because of some mingw problems, in particular: I have already mentioned
> this problem several times, I really ought to solve it at some points
> instead of speaking about it).
> So what matters IMHO is the practical implications with the compilers/C
> runtime we use for numpy/scipy (gcc, visual studio and intel compilers
> should cover most of developers/users).

We implement the complex functions completely ourselves and use only the 
real C math functions. As we compose the complex operations from real 
ones, corner cases can and apparently go wrong even if the underlying 
compiler is C99 compliant.

The new Python cmath module actually implements the corner cases using a 
lookup table. I wonder if we should follow...

Pauli Virtanen

More information about the Numpy-discussion mailing list