[Numpy-discussion] Floating point exception with numpy and embedded python interpreter

Andrew Straw strawman at astraw.com
Sat Apr 22 12:13:02 CDT 2006

bitorika at cs.tcd.ie wrote:

>>>On 19 Apr 2006, at 18:37, Andrew Straw wrote:
>>I think that numpy only accesses the SSE units through ATLAS or other
>>external library. So, build numpy without ATLAS. But I'm not 100% sure
>>anymore if there aren't any optimizations that directly use SSE if it's
>I've tried getting rid of all atlas, blas and lapack packages in my system
>and rebuilding numpy to use its own unoptimised lapack_lite, but no luck.
>Just trying to import numpy with PyImport_ImportModule("numpy") causes the
>program to crash with just a "Floating point exception" message output.
>The program I'm embedding Python in is the NS Network Simulator
>(http://www.isi.edu/nsnam/ns/). It's a complex C++ beast with its own
>Object-Tcl interpreter, but it's been working fine with embedded Python
>except for this numpy crash. I've used Numeric before and it worked fine
>as well.
>I'm lost now regarding what to work on to find a solution, anyone familiar
>with numpy internals has any suggestion?
OK, going back to your original gdb traceback, it looks like the SIGFPE
originated in the following funtion in umathmodule.c:

static double
    double mul = 1e10;
    double tmp = 0.0;
    double pinf;

    pinf = mul;
    for (;;) {
        pinf *= mul;
        if (pinf == tmp) break;
        tmp = pinf;
    return pinf;

If you try just that function (instead of the whole Python interpreter
and numpy module) and still get the exception, you'll be that much
closer to narrowing down the issue.

More information about the Numpy-discussion mailing list