Overview
ISO/IEC TS 18661-5:2025 - Floating-point extensions for C - Part 5: Supplementary attributes - specifies standard pragmas and macros that extend C (C23 / ISO/IEC 9899:2024) to support additional floating‑point attributes recommended by ISO/IEC 60559 (IEEE 754). The Technical Specification fills gaps left by C23 by providing compile‑time, translation‑time controls for evaluation formats, optimization behavior, reproducibility, and alternate exception handling for floating‑point code.
Key Topics
- Scope and purpose
- Adds standardized pragmas to express IEEE 754‑recommended attributes not covered in C23.
- Applies to implementations that define binary or decimal IEC 60559 support.
- Standard pragmas introduced
- #pragma STDC FP_FLT_EVAL_METHOD width
- #pragma STDC FP_DEC_EVAL_METHOD width
- #pragma STDC FP_ALLOW_VALUE_CHANGING_OPTIMIZATION on‑off‑switch
- #pragma STDC FP_ALLOW_ASSOCIATIVE_LAW on‑off‑switch
- #pragma STDC FP_ALLOW_DISTRIBUTIVE_LAW on‑off‑switch
- #pragma STDC FP_ALLOW_MULTIPLY_BY_RECIPROCAL on‑off‑switch
- #pragma STDC FP_ALLOW_ZERO_SUBNORMAL on‑off‑switch
- #pragma STDC FP_ALLOW_CONTRACT_FMA on‑off‑switch
- #pragma STDC FP_ALLOW_CONTRACT_OPERATION_CONVERSION on‑off‑switch
- #pragma STDC FP_ALLOW_CONTRACT on‑off‑switch
- #pragma STDC FP_REPRODUCIBLE on‑off‑switch
- #pragma STDC FENV_EXCEPT action except‑list
- Feature sets and conformance
- Four independent feature sets: evaluation formats, optimization controls, reproducibility, alternate exception handling.
- Implementations signal conformance with macros such as:
- STDC_IEC_60559_ATTRIB_EVALUATION_FORMAT = 202401L
- STDC_IEC_60559_ATTRIB_OPTIMIZATION = 202401L
- STDC_IEC_60559_ATTRIB_REPRODUCIBLE = 202401L
- STDC_IEC_60559_ATTRIB_ALTERNATE_EXCEPTION_HANDLING = 202401L
- Headers expose identifiers only when STDC_WANT_IEC_60559_ATTRIB_EXT is defined by the source.
Applications
- Compiler and toolchain vendors: implement standardized pragma support to control floating‑point evaluation formats and optimizations (e.g., enabling/disabling associative or distributive transformations, FMA contraction).
- High-performance computing & numerical libraries: enforce evaluation formats and reproducible results across platforms for scientific computing and parallel reductions.
- Embedded & safety‑critical systems: control subnormal handling, exception behavior, and value‑changing optimizations to meet deterministic or certification requirements.
- Developers and QA teams: use pragmas to isolate and debug floating‑point discrepancies, improve portability, and document intended floating‑point semantics at translation time.
Related Standards
- ISO/IEC 9899:2024 (C23) - base C standard extended by this TS
- ISO/IEC 60559:2020 - floating‑point (IEEE 754) semantics and recommended attributes
- IEEE 754 (revisions referenced in the TS)
This specification helps bridge C23 and IEEE 754 recommendations by standardizing pragma controls for predictable, portable, and auditable floating‑point behavior in C programs. Keywords: ISO/IEC TS 18661-5:2025, floating-point extensions for C, C23 pragmas, evaluation formats, reproducibility, optimization controls, alternate exception handling.