[Numpy-discussion] Numpy complex types, packing and C99
David Cournapeau
cournape@gmail....
Thu Jul 2 06:56:11 CDT 2009
On Thu, Jul 2, 2009 at 9:02 AM, David Cournapeau<cournape@gmail.com> wrote:
>
> True, but we can deal with this once we have tests: we can force to
> use our own, fixed implementations on broken platforms. The glibc
> complex functions are indeed not great, I have noticed quite a few
> problems for special value handling (e.g. cabs(inf + I * NAN) is nan,
> but should be inf, etc....).
Ok, here we are. There are two branches.
- the first one, complex_umath_tests, is a branch with thorough
covering of special values. I use the C99 standard for reference:
http://github.com/cournape/numpy/tree/complex_umath_tests
The main file is
http://github.com/cournape/numpy/blob/c29e793c220f48e317adafb8c765acd4db13cb0d/numpy/core/tests/test_umath_complex.py
Around 10 tests fail on Linux ATM.
- the second branch is the interesting one:
http://github.com/cournape/numpy/tree/C99_complex_math
It implements clog, cexp, creal, cimag, carg, cabs, ccos, csin and
csqrt. The list is dictated by my needs for windows 64, but the list
can grow arbitrarily, of course. Most the implementations are taken
from msun (the math library of FreeBSD). Unfortunately, they don't
implement that many functions compared to the glibc.
If I merge the two branches and use the npymath complex functions in
umath, there is no unit test failures anymore :)
I think I will merge the complex_umath_tests branch soon
(platform-specific failures on build bot will be interesting), unless
someone sees a problem with it.
cheers,
David
More information about the Numpy-discussion
mailing list