FIX: QuickWin Floating-Point Error Output Sent to COM1

Last reviewed: September 16, 1997
Article ID: Q86065
5.10 | 5.10 MS-DOS | OS/2 kbprg kbfixlist kbbuglist kberrmsg

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, version 5.1
  • Microsoft FORTRAN for OS/2, version 5.1

SYMPTOMS

When running a QuickWin application created by Microsoft FORTRAN version 5.1 in Microsoft Windows version 3.0 or 3.1 and a math exception is raised, Windows may generate the following error message:

   System Error: Cannot write to device AUX.

Subsequently, under Windows 3.0 a dialog box reports

   UNRECOVERABLE APPLICATION ERROR, floating point error: <errortype>

where <errortype> is the type of error that occurred. The errors may be any of the following:
  • invalid
  • denormal
  • divide by 0
  • overflow
  • underflow
  • inexact
  • unemulated
  • square root
  • stack overflow
  • stack underflow

Under Windows 3.1, an unrecoverable application error (UAE) message is generated with the error type, and then the application is closed.

CAUSE

The UAE is expected behavior, but the error output text is also being redirected to COM1. If COM1 is not connected to a receiving-capable device, the error (above) referring to AUX may result. The FORTRAN QuickWin run- time library is using an error message output routine that includes some internal debugging output directed to COM1.

The actual messages shown on a debug terminal are:

   C RUNTIME ERROR M6101: MATH - floating-point error: invalid
   C RUNTIME ERROR M6102: MATH - floating-point error: denormal
   C RUNTIME ERROR M6103: MATH - floating-point error: divide by 0
   C RUNTIME ERROR M6104: MATH - floating-point error: overflow
   C RUNTIME ERROR M6105: MATH - floating-point error: underflow
   C RUNTIME ERROR M6106: MATH - floating-point error: inexact
   C RUNTIME ERROR M6107: MATH - floating-point error: unemulated
   C RUNTIME ERROR M6108: MATH - floating-point error: square root
   C RUNTIME ERROR M6110: MATH - floating-point error: stack overflow
   C RUNTIME ERROR M6111: MATH - floating-point error: stack underflow

RESOLUTION

Error checking prior to a numeric division may prevent this problem. Also, installing a user-defined floating-point exception handling procedure with the SIGNALQQ() function can be used to prevent the output of floating-point errors.

STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN version 5.1 for MS-DOS and OS/2. This problem was corrected in FORTRAN PowerStation.

MORE INFORMATION

Sample Code 1

The following code when compiled with the /MW option will reproduce the problem:

      PROGRAM Test_Math_Exception
      REAL*4 Divisor, Result /10.0/
      REAL*4 A  /1.0/, B /1.0/

c This code will generate an M6103 - floating point error: divide by 0
      Divisor = A - B
      Result = 10.0 / Divisor

      END


Additional reference words: 5.10
KBCategory: kbprg kbfixlist kbbuglist kberrmsg
KBSubcategory: FORTLngIss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.