BUG: Some Compiler and Debugger REAL Arithmetic Results Differ

Last reviewed: March 28, 1996
Article ID: Q149157
The information in this article applies to:
  • Microsoft Fortran PowerStation for Windows 95 and Windows NT, version 4.0

SYMPTOMS

The results of some REAL double-precision arithmetic expressions generated by the compiler are different in the low order decimal digits from what is displayed for the same arithmetic expressions in the debugger.

CAUSE

Intermediate values in the debugger are saved to and reloaded from the stack. The saving and reloading of these intermediate values causes some rounding to occur.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Build a project containing the following sample code:

C Compile options needed: /Zi

      real*8  A, B, C, D

      A = 100.92
      B = -82.73
      C = -17.29
      D = 4.0

      write (*,*) (((-C)**D)+((A*D)/B))

      end

  • From the Developer Studio Build menu, choose Debug, and then select Step Into to begin the debugging process.

  • Step past the "write" statement.

  • In either the watch or quickwatch window, type the following arithmetic expression and press the ENTER key:

    (((-C)**D)+((A*D)/B))

  • View the debugger and program output.

    Output

    From the debugger: 89362.714366112600000

    Program execution: 89362.714366112590000


  • Additional reference words: 4.00
    KBCategory: kbprg kbbuglist
    KBSubcategory: FORTLngIss



    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: March 28, 1996
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.