To: J3 J3/18-120 From: Steve Lionel Subject: Control of leading zero in F format Date: 2018-February-12 Reference: 18-007 When using F format to output a value less than 1, the standard allows the implementation to choose whether to include a zero before the decimal symbol. 13.7.2.3.2 (F format) paragraph 11 says (in part): "Leading zeros are not permitted except for an optional zero immediately to the left of the decimal symbol if the magnitude of the value in the output field is less than one. The optional zero shall appear if there would otherwise be no digits in the output field." Some implementations always provide the leading zeros, some do not, and this inconsistency results in user complaints, especially when test programs produce different results across different implementations. The inconsistency also occurs for G format when the value is in a certain range. Unlike the optional sign before a positive value, there is no user control over the optional zero. This results in many user complaints of mismatched output across platforms and even failures to read Fortran-produced output in non-Fortran programs. The proposal is to add control edit descriptors, analogous to the SS, SP and S edit descriptors, to allow the programmer to specify the desired behavior. The author suggests: SLZ - Suppress leading zero PLZ - Provide leading zero LZ - Implementation-defined behavior The requirement of the leading zero when otherwise no digits would appear is to remain. Continuing the analogy with SS, SP and S, and the SIGN= OPEN specifier, a LEADZERO= OPEN specifier would be added with possible values of 'SUPPRESS', 'PROVIDE', and 'PROCESSOR_DEFINED'. The default would be 'PROCESSOR_DEFINED'.