GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
fortran

Gfortran adds support for Fortran 2023 EX format read.

The Gfortran compiler now implements the Fortran 2023 `EX` edit-descriptor for reading hexadecimal-significand or decimal floating-point input.

The Gfortran compiler now fully supports the EX edit-descriptor for READ statements, as specified in Fortran 2023. This new functionality in libgfortran’s read.c allows reading floating-point values presented in hexadecimal-significand form (e.g., 0X1.AP+0) for exact conversion, or as standard decimal input. It also handles INF and NAN representations, respecting BN/BZ blank handling and kP scale factors, enabling robust and standard-compliant input processing for advanced floating-point literals.

In Details

This commit introduces the read_ex function in libgfortran/io/read.c to implement the EX.w.d edit-descriptor for Fortran 2023 input. The formatted_transfer_scalar_read function in transfer.c gains a new FMT_EX dispatch case. read_ex primarily uses strtod/strtold for 0X<sig>P<exp> hexadecimal-significand input, ensuring bit-for-bit exact conversion for floating-point literals, crucial for scientific computing. It falls back to standard F-format decimal parsing for other inputs, incorporating support for INF/NAN, BN/BZ blank interpretation, and kP scale factors. This…

For Context

Compilers for languages like Fortran handle reading and writing numbers from files or user input. Fortran, commonly used in scientific and engineering fields, has specific ways to format these numbers. This update brings the Gfortran compiler (the Fortran part of GCC) up to date with a new feature from the Fortran 2023 standard called the EX format. This EX format allows for very precise reading of floating-point numbers (numbers with decimal points or exponents). Specifically, it can now directly understand numbers written in a special 'hexadecimal-significand' form (like 0x1.A P+0), which ensures that the number is read with exact precision. If the number isn't in that special form, it can still read standard decimal numbers, including special values like 'infinity' (INF) or 'not a number' (NAN). This new capability is important for scientific applications where exact numerical representation is critical, providing more robust and standards-compliant ways to handle numeric…

Filed Under: fortranlanguage featureionumerical computing