Recently I've found a nice way to trapping SIGFPE (floating-point-exceptions) when write DSP algorithm. It's fenv.h which is a standard header and provide the function feenableexcept().
Setting it up with
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
when running a gdb session, the program will stop at the line were the error occur and you get the exact line number with the call in question. This make it a lot easier to find the culprit in the source, special when you work on bigger programs.
trapping-floating-point-exceptions
Moderators: MattKingUSA, khz