_control87, _controlfp
Go Up to float.h Index
Header File
float.h
Prototype
unsigned int _control87(unsigned int newcw, unsigned int mask); unsigned int _controlfp(unsigned int newcw, unsigned int mask);
Description
Manipulates the floating-point control word.
_control87 retrieves or changes the floating-point control word.
The floating-point control word is an unsigned int that, bit by bit, specifies certain modes in the floating-point package; namely, the precision, infinity, and rounding modes. Changing these modes lets you mask or unmask floating-point exceptions.
_control87 matches the bits in mask to the bits in newcw. If a mask bit equals 1, the corresponding bit in newcw contains the new value for the same bit in the floating-point control word, and _control87 sets that bit in the control word to the new value.
Here is a simple illustration:
If mask equals 0, _control87 returns the floating-point control word without altering it.
_controlfp is for Microsoft compatibility. _controlfp is identical to _control87 except that it always removes (turns off) the EM_DEMORMAL bit from the mask parameter.
Return Value
The bits in the value returned reflect the new floating-point control word. For a complete definition of the bits returned by _control87, see the header file float.h.
Portability
| POSIX | ANSI C | ANSI C++ | Win32 | Win64 | macOS |
|---|---|---|---|---|---|
| _control87 | + | + | + | + | |
| _controlfp | + | + | + | + |