Function name : _control87
Header file : <float.h>
Function prototype : unsigned int _control87(unsigned int new,unsigned int mask);
Function : Get and set floating point control words
Parameters : unsigned int new new control word bit value, unsigned int mask sets the mask of the new control word bit
Return value : Returns a floating point control word
Program example : Calculate the product of two double precisions under different control words
#include<stdio.h>#include<float.h>intmain(){doublea=0.1;printf(original:0x%4xn,_control87(0,0));//Output the original control word printf(% 1.1f*%1.1f=%.15en,a,a,a*a);//Calculate the product of two double precisions//Output the 24-bit control word printf(24-bit:0x%4x n,_control87(_PC_24,_MCW_PC));printf(%1.1f*%1.1f=%.15en,a,a,a*a);//Calculate the product of two double precision return0;}
Running results:
original:0x8001f0.1*0.1=1.000000000000000e-00224-bit:0xa001f0.1*0.1=9.999999776482582e-003