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

Charles R Harris charlesr.harris at gmail.com
Tue Jul 29 10:13:23 EDT 2008


On Tue, Jul 29, 2008 at 5:59 AM, Pauli Virtanen <pav at iki.fi> wrote:

> Tue, 29 Jul 2008 20:16:36 +0900, David Cournapeau wrote:
> [clip]
> > 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:
>
>        http://www.open-std.org/jtc1/sc22/wg14/www/standards
>
> > 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...


We also need speed. I think we just say behaviour on the branch cuts is
undefined, which is numerically true in any case, and try to get the nan's
and infs sorted out. But only if the costs are reasonable.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080729/c3a3710f/attachment.html>


More information about the NumPy-Discussion mailing list