DOCUMENT:Q149157 02-NOV-1999 [fortran] TITLE :BUG: Some Compiler and Debugger REAL Arithmetic Results Differ PRODUCT :Microsoft Fortran Compiler PROD/VER::4.0 OPER/SYS: KEYWORDS:kbFortranPS kbLangFortrankbbuglist ====================================================================== ------------------------------------------------------------------------------- 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: 2. 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 3. From the Developer Studio Build menu, choose Debug, and then select Step Into to begin the debugging process. 4. Step past the "write" statement. 5. In either the watch or quickwatch window, type the following arithmetic expression and press the ENTER key: " (((-C)**D)+((A*D)/B)) " (without the quotation marks) 6. View the debugger and program output. Output ------ From the debugger: 89362.714366112600000 Program execution: 89362.714366112590000 Additional query words: 4.00 ====================================================================== Keywords : kbFortranPS kbLangFortran kbbuglist Technology : kbAudDeveloper kbPTProdChange kbFortranSearch kbFORTRANPower400NT Version : :4.0 ============================================================================= 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. Copyright Microsoft Corporation 1999.