The error messages listed below correspond to exceptions generated by the math coprocessor hardware. Refer to the manufacturer's documentation for your processor for a detailed discussion of hardware exceptions. These errors may also be detected by the floating-point emulator or alternate math library.@ERP = Using the Microsoft C/C++ default math coprocessor control-word settings, the following exceptions are masked and do not occur:
Exception | Default Masked Action |
Denormal | Exception masked |
Underflow | Result goes to 0.0 |
Inexact | Exception masked |
For information on how to change the floating-point control word, see the _control87 function in the Run-Time Library Reference.
The following exceptions do not occur with code generated by the Microsoft C/C++ Compiler or code provided in the standard Microsoft C/C++ run-time libraries or the MFC class libraries:
square root
stack underflow
unemulated
The floating-point error messages have the following format:
run-time error M6xxx : MATH
- floating-point error : messagetext
Number | Floating-Point Math Error Message |
M6101 | invalid |
An invalid operation occurred. This error usually occurs when the operand is NAN (not a number) or infinity. | |
This error terminates the program with exit code 129. | |
M6102 | denormal |
A very small floating-point number was generated, which may no longer be valid because of a loss of significance. Denormal floating-point exceptions are usually masked, causing them to be trapped and operated upon. | |
This error terminates the program with exit code 130. | |
M6103 | divide by 0 |
A floating-point operation attempted to divide by zero. | |
This error terminates the program with exit code 131. | |
M6104 | overflow |
An overflow occurred in a floating-point operation. | |
This error terminates the program with exit code 132. | |
M6105 | underflow |
An underflow occurred in a floating-point operation. Underflow floating-point exceptions are usually masked, causing the underflowing value to be replaced by 0.0. | |
This error terminates the program with exit code 133. | |
M6106 | inexact |
Loss of precision occurred in a floating-point operation. This exception is usually masked. Many floating-point operations cause a loss of precision. | |
This error terminates the program with exit code 134. | |
M6107 | unemulated |
An attempt was made to execute a coprocessor instruction that is invalid or is not supported by the emulator. | |
This error terminates the program with exit code 135. | |
M6108 | square root |
The operand in a square-root operation was negative. | |
This error terminates the program with exit code 136. |
Note:
The sqrt function in the C run-time library and the FORTRAN intrinsic function SQRT do not generate this error. The C sqrt function checks the argument before performing the operation and returns an error value if the operand is negative. The FORTRAN SQRT function generates the DOMAIN error M6201 instead of this error.
M6110 | stack overflow |
A floating-point expression caused a stack overflow on the 8087/80287/80387 coprocessor or the emulator. | |
Stack-overflow floating-point exceptions are trapped up to a limit of seven levels in addition to the eight levels usually supported by the 8087/80287/80387 coprocessor. | |
This error terminates the program with exit code 138. | |
M6111 | stack underflow |
A floating-point operation resulted in a stack underflow on the 8087/80287/80387 coprocessor or the emulator. | |
This error is often caused by a call to a long double function that does not return a value. For example, the following generates this error when compiled and run:
long double ld() {}; main () { ld(); } |
|
This error terminates the program with exit code 139. | |
M6201 | function : _DOMAIN error |
An argument to the given function was outside the domain of legal input values for that function. | |
For example, the following statements generate this error:
result = sqrt(-1.0) // C statement result = SQRT(-1.0) ! FORTRAN statement |
|
This error calls the _matherr function with the function name, its arguments, and the error type. You can rewrite the _matherr function to customize the handling of certain run-time floating-point math errors. | |
M6202 | function : _SING error |
An argument to the given function was a singularity value for this function. The function is not defined for that argument. | |
For example, in FORTRAN the following statement generates this error:
result = LOG10(0.0) |
|
This error calls the _matherr function with the function name, its arguments, and the error type. You can rewrite the _matherr function to customize the handling of certain run-time floating-point math errors. | |
M6203 | function : _OVERFLOW error |
The given function result was too large to be represented. | |
This error calls the _matherr function with the function name, its arguments, and the error type. You can rewrite the _matherr function to customize the handling of certain run-time floating-point math errors. | |
M6205 | function : _TLOSS error |
A total loss of significance (precision) occurred. | |
This error may be caused by giving a very large number as the operand of sin, cos, or tan because the operand must be reduced to a number between 0 and 2p. |