The information in this article applies to:
SUMMARYOn pages 149 and 150 of the version 5.0 and version 5.1 "Microsoft FORTRAN Reference" manual, the iteration count for DO loops is incorrectly stated to default to INTEGER*2 storage. DO loop iteration counts actually appear to default to the same precision as the DO variable, except when the start value and stop value are constants, rather than variables. In this case, the DO loop iteration count appears to default to INTEGER*4 storage. MORE INFORMATIONPage 150 states that "The iteration count is computed using two-byte precision (the default)", and the code on page 150 of the Reference Manual illustrates an iteration overflow when compiled with /4Yb or $DEBUG. However, declaring the DO variable 'n' as integer*4 or removing the IMPLICIT statement removes the iteration overflow, indicating that the iteration count precision is dependent on the precision of the DO variable. This is demonstrated by the code below, which both compiles and runs without errors, even when compiled with /4Yb or $DEBUG: Sample code
Declaring the DO variable as INTEGER*2 and the rest of the variables as
INTEGER*4 generates an integer overflow error when compiled with /4Yb or
$DEBUG.
Sample code
Therefore, the iteration count precision is dependent on the precision of
the DO variable. Furthermore, the code on page 149 does not cause the
iteration overflow error as stated. This code is as follows:
Sample code
This code executes without error when compiled with /4Yb or $DEBUG,
indicating that when constants are used for the start and stop values, the
iteration count defaults to INTEGER*4 precision.
Additional query words: 5.00 nofps 5.10 docerr
Keywords : |
Last Reviewed: November 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |