X3J3/96-143 TO: X3J3 FROM: R. Baker Kearfott SUBJECT: Specifying default precision (Minor Technical Enhancement 12) JOR item 35 deals with specifying a default precision for real data types in Fortran 2000. Argument in favor: It makes it easier for users to transport codes, especially legacy codes that do not use type parameters on each occurrence of constants. Argument against: It supports an older paradigm, namely single versus double precision, and constants that are specified without type parameters. Some feel that this paradigm should not be encouraged. __________________________________________________________________ SYNTAX: As far as I can see, the syntax proposed in the JOR item suffices. The change does not affect any current implementation, but proposes a small amount of additional syntax. Namely, IMPLICIT (REAL,KIND=SELECTED_REAL_KIND(10,30)) (DEFAULT) declares the 'default real' kind to be a processor-dependent type which allows 10 decimal digits and an exponent range of at least 30. Each real variable and real literal constant appearing in a program unit containing the above declaration will be of that type. default declaration statement is IMPLICIT (type, kind-selector ) (DEFAULT) type is INTEGER or REAL or DOUBLE PRECISION or COMPLEX or LOGICAL or INTERVAL kind-selector is ( [ KIND = ] scalar-int-initialization-expr ) Note: For example, a large-format default integer type can be specified as default for use in I/O statements. Note: The intrinsically defined relational operators yield a type of "default logical." Does allowing the user to change the default cause more work to be required to implement the intrinsic relational operators? LOGICAL is included for regularity. A possible straw vote: Include logical / exclude logical Note: The interval data type may possibly be optional. If so, the optionality would be reflected in the final edits to this item. __________________________________________________________________ EDITS: In 5.3 after R543 (p. 63, line 40): _________________________________ or IMPLICIT (type, kind-selector ) (DEFAULT) type is INTEGER or REAL or DOUBLE PRECISION or COMPLEX or LOGICAL or INTERVAL kind-selector is ( [ KIND = ] scalar-int-initialization-expr ) Constraint: If IMPLICIT (type, kind-selector) (DEFAULT) appears, it shall appear before any other implicit statements and before any other occurrences of symbolic variable names or literal constants. Immediately above note 5.24 (page 64): _____________________________________ If the IMPLICIT (type, kind-selector) (DEFAULT) construction appears, then the default kind of variables and literal constants of type type shall be that specified by kind-selector.