To: J3 J3/19-139r1 From: Dan Nagle Subject: Specifications and Edits for log & friends Date: 2019-February-12 Reference: 18-257r2, 18-007r1 1 Introduction The log and friends work item was approved for further work at 217. This paper attempts to craft specifications. I hope the syntax choice made at 217 is reaffirmed, but the vote should be taken. This paper also attempts to craft edits. The original spelling was log8, log16, log32, log64, real16. However, the log names were thought to be confusing, so spelling logical8, logical16, logical32, logical64 was chosen. 2 Discussion For type integer, the ISO_FORTRAN_ENV intrinsic module has INT8, INT16, INT32, INT64 constants, and also the constant (unsorted) array INTEGER_KINDS. For type real, it also has REAL32, REAL64, REAL128 constants, and the (unsorted) REAL_KINDS array. However, there are no corresponding constants for type logical. And the LOGICAL_KINDS array is similarly unsorted, so many programmers will find it tricky at best to extract the kind value whose type will best fit a given criteria. At the same time, AI work is now using a 16-bit real (or smaller), so a way to get the kind value of such a real, if available, is also desired. This paper does not discuss the implications of this for interoperability. 3 Specifications Default integer constants are added to ISO_FORTRAN_ENV that have values of kind parameters that specify a logical type whose storage size is 8, 16, 32, 64 bits, respectively, and a default integer constant is added to ISO_FORTRAN_ENV that has a value of a kind parameter that specifies a real type whose storage size is 16 bits. If the processor supports no kind of a particular size, that constant shall be equal to -2 if the processor supports a kind with larger size and -1 otherwise. 4 Syntax The constants of kind values for type logical are named LOGICAL8, LOGICAL16, LOGICAL32, and LOGICAL64, and the constant of kind value for type real is named REAL16. 5 Edits to 18-007r1 { add remark to Introduction in the bullet item for Data declaration } [xiii] add "Constants LOGICAL8, LOGICAL16, LOGICAL32, LOGICAL64 provide kind values for a logical type whose storage size is 8, 16, 32, 64, respectively. Constant REAL16 provides the kind value of a real kind whose storage size is 16 bits." { Introduction briefly describes new features } { 16.10.2 The ISO_FORTRAN_ENV intrinsic module } { after subclause 16.10.2.20 LOGICAL_KINDS p1 } [430:22+] after the subclause add a new subclause "16.10.2.20+ LOGICAL8, LOGICAL16, LOGICAL32, LOGICAL64 The values of these default integer scalar constants shall be those of the kind type parameters that specify a LOGICAL type whose storage size expressed in bits is 8, 16, 32, and 64 respectively. If, for any of these constants, the processor supports more than one kind of that size, it is processor dependent which kind value is provided. If the processor supports no kind of a particular size, that constant shall be equal to -2 if the processor supports a kind with larger size and -1 otherwise." { similar words to int and real } { change 16.10.2.25 REAL32, REAL64, and REAL128 to include REAL16 } [431:1] change the name of the subclause change "REAL32, REAL64, and REAL128" to "REAL16, REAL32, REAL64, REAL128" [431:2-3p1] in the sentence "The values of these default integer scalar named constants shall be those of the kind type parameters that specify a REAL type whose storage size expressed in bits is 32, 64, and 128 respectively." change "bits is 32, 64," to "bits is 16, 32, 64," so the resulting sentence reads "The values of these default integer scalar named constants shall be those of the kind type parameters that specify a REAL type whose storage size expressed in bits is 16, 32, 64, and 128 respectively." and the resulting whole paragraph with heading reads "16.10.2.25 REAL16, REAL32, REAL64, and REAL128 The values of these default integer scalar named constants shall be those of the kind type parameters that specify a REAL type whose storage size expressed in bits is 16, 32, 64, and 128 respectively. If, for any of these constants, the processor supports more than one kind of that size, it is processor dependent which kind value is provided. If the processor supports no kind of a particular size, that constant shall be equal to -2 if the processor supports kinds of a larger size and -1 otherwise." { add real16 to the lists } { the values in iso_fortran_env are already PD in A.2 } { end }