Show: Delphi C++
Display Preferences

_control87, _controlfp

From RAD Studio
Jump to: navigation, search

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:

Original control word: 0100 0011 0110 0011
mask: 1000 0001 0100 1111
newcw: 1110 1001 0000 0101
Changing bits: 1xxx xxx1 x0xx 0101


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 OS X
_control87 + + + +
_controlfp + + + +

See Also

Personal tools
In other languages
Previous Versions
Assistance