Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
_control87
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The _control87 function gets and sets the floating-point control
word, which allows the program to change the precision, rounding,
and infinity modes in the floating-point math package. You can
mask or unmask floating-point exceptions by using the _control87
function.
If the value for <mask> is equal to 0, _control87 gets the
floating-point control word. If mask is nonzero, a new value for
the control word is set in the following manner: for any bit that
is on (equal to 1) in <mask>, the corresponding bit in <new> is
used to update the control word. To put it another way,
fpcntrl = ( ( fpcntrl & ~mask ) | ( new & mask ) )
where fpcntrl is the floating-point control word.
The possible values for the mask constant (<mask>) and new control
values (<new>) are shown below:
Mask Control Hex
Constant Meaning Values Value Meaning
MCW_EM Interrupt
exception 0x003F
EM_INVALID 0x0001 Invalid operation
EM_DENORMAL 0x0002 Denormal
EM_ZERODIVIDE 0x0004 Zero divide
EM_OVERFLOW 0x0008 Overflow
EM_UNDERFLOW 0x0010 Underflow
EM_INEXACT 0x0020 Inexact (precision)
MCW_IC Infinity
control 0x1000
IC_AFFINE 0x1000 Affine
IC_PROJECTIVE 0x0000 Projective
MCW_RC Rounding
control 0x0C00
RC_CHOP 0x0C00 Chop
RC_UP 0x0800 Up
RC_DOWN 0x0400 Down
RC_NEAR 0x0000 Near
MCW_PC Precision
control 0x0300
PC_24 0x0000 24 bits
PC_53 0x0200 53 bits
PC_64 0x0300 64 bits
Return Value
The bits in the value returned indicate the floating-point control
state. See FLOAT.H for a complete definition of the bits returned
by _control87.
-♦-