[Numpy-discussion] Floating point exception with numpy and embedded python interpreter
Arkaitz Bitorika
arkaitz.bitorika at gmail.com
Mon Apr 24 09:24:03 EDT 2006
Andrew,
I've verified that the function causes the exception when embedded in
the program but not when used from a simple C program with just a main
() function. The successful version iterates 31 times over the for
loop while the crashing one fails the 30th time that it does "pinf *=
mul".
Now we know exactly where the crash is, but no idea how to fix it ;).
It doesn't look it should be related to SSE2 flags, it's just doing a
big multiplication, but I don't know enough about low level C and
floating point operations to understand why it may be throwing the
exception there. Any idea how I could avoid that function crashing?
Thanks,
Arkaitz
On 22 Apr 2006, at 20:12, Andrew Straw wrote:
> OK, going back to your original gdb traceback, it looks like the
> SIGFPE
> originated in the following funtion in umathmodule.c:
>
> static double
> pinf_init(void)
> {
> 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