C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
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
─────Run-Time Library───────────────────────────────────────────────────────
 
     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.
                                    -♦-