Mail Archives: djgpp-workers/2003/04/26/11:33:21
Eli said:
> Btw, is code such as this:
>
> double tmp_d = NAN;
>
> safe when numerical exceptions are unmasked in the FP control word?
I made this program:
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
double d;
printf("FPU CW: 0x%08x.\n", _control87(0, 0));
d = NAN;
printf("d = %.20g.\n", d);
/* Fault on FPU exception. */
_control87(0, 0x3f);
printf("FPU CW: 0x%08x.\n", _control87(0, 0));
d = NAN;
printf("d = %.20g.\n", d);
return(EXIT_SUCCESS);
}
When run, it says:
FPU CW: 0x0000037f.
d = NaN.
FPU CW: 0x00000340.
d = NaN.
I. e. no crash traceback. Does that answer the question?
Right,
MartinS
- Raw text -