initialize for floating-point operations
#include <float.h> void _fpreset( void );
After a floating-point exception, it may be necessary to call the _fpreset() function before any further floating-point operations are attempted.
#include <stdio.h>
#include <float.h>
char *status[2] = { "No", " " };
void main()
{
unsigned int fp_status;
fp_status = _status87();
printf( "80x87 status\n" );
printf( "%s invalid operation\n",
status[ (fp_status & SW_INVALID) == 0 ] );
printf( "%s denormalized operand\n",
status[ (fp_status & SW_DENORMAL) == 0 ] );
printf( "%s divide by zero\n",
status[ (fp_status & SW_ZERODIVIDE) == 0 ] );
printf( "%s overflow\n",
status[ (fp_status & SW_OVERFLOW) == 0 ] );
printf( "%s underflow\n",
status[ (fp_status & SW_UNDERFLOW) == 0 ] );
printf( "%s inexact result\n",
status[ (fp_status & SW_INEXACT) == 0 ] );
_fpreset();
}
Intel
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |