To: J3 J3/25-189r1 From: Patrick Fasano Subject: Requirements and specifications for interoperability with C interchange and extended types Date: 2025-October-28 References: ISO/IEC 9899:2024 Programming languages -- C ("C23") (working draft N3220) WG5/N2249 Fortran 202Y Work Items 23-176 Add extended floating-point types defined in ISO C23 to ISO_C_BINDING ISO/IEC 60559:2020 Floating-Point arithmetic IEEE 754-2019 IEEE Standard for Floating-Point Arithmetic 25-189 Requirements and specifications for interoperability with C interchange and extended types 1 Background ============ bg01. The ISO C23 specification (ISO/IEC 9899:2024) added support for interchange and extended floating-point types (C23 Annex H). The current Fortran 202Y work list WG5/N2249 includes adding interoperability with these types as accepted work item US05. At meeting #230 in June 2023, J3 accepted paper 23-176 as background/use-case for additional interchange types. bg03. This paper contains formal requirements and specifications for Fortran 202Y proposal US05, "Add extended floating-point types defined in ISO C23 to ISO_C_BINDING". bg05. The C23 standard adds a large number of new types, importing significant portions of ISO/IEC 60559 (a.k.a IEEE 754) into its specification. During discussion of 25-189 at meeting #237, a straw poll of J3 indicated strong consensus for adding support for extended binary floating types (rq07-rq09) and decimal floating types (rq11), but strong consensus against extended decimal floating types (25-189 rq13) and arbitrary-size floating types (25-189 rq15-rq17). This revision amends the paper to reflect this consensus. 2 Requirements ============== rq02. The ISO_C_BINDING module shall provide integer named constants for KIND parameters corresponding to the C interchange floating types '_Float16', '_Float32', '_Float64', and '_Float128'. rq03. If the companion processor defines '__STDC_IEC_60559_BFP__' and '__STDC_IEC_60559_TYPES__', then the KIND parameters corresponding to '_Float32' and '_Float64' shall equal those corresponding to 'float' and 'double', respectively. rq05. The ISO_C_BINDING module shall provide integer named constants for KIND parameters corresponding to the C interchange complex types '_Float16_Complex', '_Float32_Complex', '_Float64_Complex', and '_Float128_Complex'. The values of the named constants shall equal those of the respective constants for the interchange floating types. rq07. The ISO_C_BINDING module shall provide integer named constants for KIND parameters corresponding to the C extended floating types '_Float32x', '_Float64x', and '_Float128x'. rq09. The ISO_C_BINDING module shall provide integer named constants for KIND parameters corresponding to the C extended complex types '_Float32x_Complex', '_Float64x_Complex', and '_Float128x_Complex'. The values of the named constants shall match those of the respective constants for the extended floating types. rq11. The ISO_C_BINDING module shall provide integer named constants for KIND parameters corresponding to the C interchange decimal floating types '_Decimal32', '_Decimal64', and '_Decimal128'. 3 Specifications ================ sp01. For all integer named constants to be added to the ISO_C_BINDING module, the value shall be a valid real kind type parameter or shall be -1 if the companion processor's type does not have a precision equal to the precision of any of the Fortran processor's real kinds, -2 if the companion processor's type does not have a range equal to the range of any of the Fortran processor's real kinds, -3 if the companion processor's type has neither the precision nor range of any of the Fortran processor's real kinds, -4 if there is no interoperating Fortran processor kind for other reasons, and -5 if the companion processor does not define the corresponding C type. sp02. To the ISO_C_BINDING module, add the following integer named constants for real KIND parameters: +----------------+--------------------+ | Named constant | C interchange type | +----------------+--------------------+ | C_FLOAT16 | _Float16 | | C_FLOAT32 | _Float32 | | C_FLOAT64 | _Float64 | | C_FLOAT128 | _Float128 | +----------------+--------------------+ If the companion processor defines '__STDC_IEC_60559_BFP__' and '__STDC_IEC_60559_TYPES__', then the constants 'C_FLOAT32' and 'C_FLOAT64' shall have the same values as 'C_FLOAT' and 'C_DOUBLE', respectively (C2023 H.2.4.2). sp05. To the ISO_C_BINDING module, add the following integer named constants for real KIND parameters: +--------------------+--------------------+ | Named constant | C interchange type | +--------------------+--------------------+ | C_FLOAT16_COMPLEX | _Float16_Complex | | C_FLOAT32_COMPLEX | _Float32_Complex | | C_FLOAT64_COMPLEX | _Float64_Complex | | C_FLOAT128_COMPLEX | _Float128_Complex | +--------------------+--------------------+ The values of each of these named constants shall be the same as the respective constants defined in sp01. sp07. To the ISO_C_BINDING module, add the following integer named constants for real KIND parameters: +----------------+-----------------+ | Named constant | C extended type | +----------------+-----------------+ | C_FLOAT32X | _Float32x | | C_FLOAT64X | _Float64x | | C_FLOAT128X | _Float128x | +----------------+-----------------+ sp09. To the ISO_C_BINDING module, add the following integer named constants for real KIND parameters: +---------------------+--------------------+ | Named constant | C extended type | +---------------------+--------------------+ | C_FLOAT32X_COMPLEX | _Float32x_Complex | | C_FLOAT64X_COMPLEX | _Float64x_Complex | | C_FLOAT128X_COMPLEX | _Float128x_Complex | +---------------------+--------------------+ sp11. To the ISO_C_BINDING module, add the following integer named constants for real KIND parameters: +----------------+--------------------+ | Named constant | C interchange type | +----------------+--------------------+ | C_DECIMAL32 | _Decimal32 | | C_DECIMAL64 | _Decimal64 | | C_DECIMAL128 | _Decimal128 | +----------------+--------------------+ === END ===