INF: matherr() and Trapping Floating-Point Errors

ID Number: Q22317

4.00 5.00 5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

matherr() does trap inline floating-point errors. matherr() only traps

floating-point errors generated by functions in the math libraries.

For example, the following program returns control to the matherr()

routine, not yours:

#include <math.h>

matherr(x)

struct exception *x;

{

x->retval=2;

return(1);

}

main()

{

double f;

f=2.0;

while (1)

f*=f;

}

To trap inline floating-point errors such as the one above, we

recommend that you use signal with SIGFPE (see the Microsoft C

run-time reference manual).

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00