Function name : _clear87
Header file : <float.h>
Function prototype : unsigned int _clear87(void);
Function : Get and clear the status word
Parameters : no parameters
Return value : Return the floating point status word before clearing
program :
#include<stdio.h>#include<float.h>intmain(){doublea=1e-45,b;floatm,n;printf(status:%.4x-clearn,_clear87());//clear Floating point status word, and output n=a;//Store the underflow value into n printf(status:%.4x-inexactn,_clear87());//Clear the floating point status word, and output b =n;//Assign the correct value to bprintf(status:%.4x-denormaln,_clear87());//Clear the floating point status word and output return0;}
Running results:
status:0000-clearstatus:0003-inexactstatus:80000-denormal