Programming languages, their environments, and system software interfaces - Floating-point extensions for C - Part 5: Supplementary attributes

This document specifies extensions to programming language C to include pragmas corresponding to attributes specified and recommended in ISO/IEC 60559 but not supported in ISO/IEC 9899:2024 (also referred to as C23).

Langages de programmation, leurs environnements et interfaces du logiciel système — Extensions à virgule flottante pour C — Partie 5: Attributs supplémentaires

General Information

Status
Published
Publication Date
13-Mar-2025
Current Stage
6060 - International Standard published
Start Date
14-Mar-2025
Due Date
25-May-2025
Completion Date
14-Mar-2025

Relations

Effective Date
06-Jun-2022

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.

Technical specification

ISO/IEC TS 18661-5:2025 - Programming languages, their environments, and system software interfaces — Floating-point extensions for C — Part 5: Supplementary attributes Released:14. 03. 2025

English language
20 pages
sale 15% off
Preview
sale 15% off
Preview

Frequently Asked Questions

ISO/IEC TS 18661-5:2025 is a technical specification published by the International Organization for Standardization (ISO). Its full title is "Programming languages, their environments, and system software interfaces - Floating-point extensions for C - Part 5: Supplementary attributes". This standard covers: This document specifies extensions to programming language C to include pragmas corresponding to attributes specified and recommended in ISO/IEC 60559 but not supported in ISO/IEC 9899:2024 (also referred to as C23).

This document specifies extensions to programming language C to include pragmas corresponding to attributes specified and recommended in ISO/IEC 60559 but not supported in ISO/IEC 9899:2024 (also referred to as C23).

ISO/IEC TS 18661-5:2025 is classified under the following ICS (International Classification for Standards) categories: 35.060 - Languages used in information technology. The ICS classification helps identify the subject area and facilitates finding related standards.

ISO/IEC TS 18661-5:2025 has the following relationships with other standards: It is inter standard links to ISO/IEC TS 18661-5:2016. Understanding these relationships helps ensure you are using the most current and applicable version of the standard.

You can purchase ISO/IEC TS 18661-5:2025 directly from iTeh Standards. The document is available in PDF format and is delivered instantly after payment. Add the standard to your cart and complete the secure checkout process. iTeh Standards is an authorized distributor of ISO standards.

Standards Content (Sample)


Technical
Specification
ISO/IEC TS 18661-5
Second edition
Programming languages, their
2025-03
environments, and system software
interfaces — Floating-point
extensions for C —
Part 5:
Supplementary attributes
Langages de programmation, leurs environnements et interfaces
du logiciel système — Extensions à virgule flottante pour C —
Partie 5: Attributs supplémentaires
Reference number
© ISO/IEC 2025
All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may
be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on
the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below
or ISO’s member body in the country of the requester.
ISO copyright office
CP 401 • Ch. de Blandonnet 8
CH-1214 Vernier, Geneva
Phone: +41 22 749 01 11
Email: copyright@iso.org
Website: www.iso.org
Published in Switzerland
© ISO/IEC 2025 – All rights reserved
ii
Contents Page
Foreword .iv
Introduction .v
1 Scope . 1
2 Normative references . 1
3 Terms and definitions . 1
4 Conformance . 1
5 C standard conformance . 2
5.1 Freestanding implementations . .2
5.2 Predefined macros .2
5.3 Standard headers .2
6 Standard pragmas . 2
7 Evaluation formats . 3
7.1 General .3
7.2 Evaluation method pragma .3
7.3 Evaluation method pragma for decimal floating types .4
7.4 Effective evaluation method macros .4
7.5 Evaluation type macros .4
7.6 Evaluation formats for .5
8 Optimization controls . 5
8.1 General .5
8.2 The FP_ALLOW_VALUE_CHANGING_OPTIMIZATION pragma .6
8.3 The FP_ALLOW_ASSOCIATIVE_LAW pragma .6
8.4 The FP_ALLOW_DISTRIBUTIVE_LAW pragma .7
8.5 The FP_ALLOW_MULTIPLY_BY_RECIPROCAL pragma .7
8.6 The FP_ALLOW_ZERO_SUBNORMAL pragma .8
8.7 The FP_ALLOW_CONTRACT_FMA pragma .8
8.8 The FP_ALLOW_CONTRACT_OPERATION_CONVERSION pragma .9
8.9 The FP_ALLOW_CONTRACT pragma .9
9 Reproducibility . 10
9.1 General .10
9.2 The FP_REPRODUCIBLE pragma.10
9.3 Reproducible code .11
10 Alternate exception handling .12
10.1 General . 12
10.2 The FENV_EXCEPT pragma . 13
Bibliography .20

© ISO/IEC 2025 – All rights reserved
iii
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission) form the specialized system for worldwide standardization. National bodies that are
members of ISO or IEC participate in the development of International Standards through technical
committees established by the respective organization to deal with particular fields of technical activity.
ISO and IEC technical committees collaborate in fields of mutual interest. Other international organizations,
governmental and non-governmental, in liaison with ISO and IEC, also take part in the work.
The procedures used to develop this document and those intended for its further maintenance are described
in the ISO/IEC Directives, Part 1. In particular, the different approval criteria needed for the different types
of document should be noted. This document was drafted in accordance with the editorial rules of the ISO/
IEC Directives, Part 2 (see www.iso.org/directives or www.iec.ch/members_experts/refdocs).
ISO and IEC draw attention to the possibility that the implementation of this document may involve the
use of (a) patent(s). ISO and IEC take no position concerning the evidence, validity or applicability of any
claimed patent rights in respect thereof. As of the date of publication of this document, ISO and IEC had not
received notice of (a) patent(s) which may be required to implement this document. However, implementers
are cautioned that this may not represent the latest information, which may be obtained from the patent
database available at www.iso.org/patents and https://patents.iec.ch. ISO and IEC shall not be held
responsible for identifying any or all such patent rights.
Any trade name used in this document is information given for the convenience of users and does not
constitute an endorsement.
For an explanation of the voluntary nature of standards, the meaning of ISO specific terms and expressions
related to conformity assessment, as well as information about ISO's adherence to the World Trade
Organization (WTO) principles in the Technical Barriers to Trade (TBT) see www.iso.org/iso/foreword.html.
In the IEC, see www.iec.ch/understanding-standards.
This document was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 22, Programming languages, their environments and system software interfaces.
This second edition cancels and replaces the first edition (ISO/IEC TS 18661-5:2016), which has been
technically revised.
The main changes are as follows:
— The specification has been updated to extend ISO/IEC 9899:2024.
— Conformance macros have been added to allow conformance to each of the four feature sets (evaluation
formats, optimization controls, reproducibility, and alternate exception handling) independently.
A list of all parts in the ISO/IEC 18661 series can be found on the ISO website.
Any feedback or questions on this document should be directed to the user’s national standards
body. A complete listing of these bodies can be found at www.iso.org/members.html and
www.iec.ch/national-committees.

© ISO/IEC 2025 – All rights reserved
iv
Introduction
The IEEE 754-1985 standard for binary floating-point arithmetic was motivated by an expanding diversity
in floating-point data representation and arithmetic, which made writing reliable programs, debugging
and moving programs between systems exceedingly difficult. Now the great majority of systems provide
data formats and arithmetic operations according to IEEE 754. Corresponding versions of IEEE 754 and
ISO/IEC 60559 have equivalent content.
Support for IEEE 754-1985 was added in ISO/IEC 9899:1999 (also referred to as C99), and ISO/IEC 9899:2018
is still based on IEEE 754-1985. However, IEEE 754 underwent a major revision in 2008 and a minor revision
in 2019, which added several new features.
The purpose of the ISO/IEC 18661 series (first published 2014 through 2016) has been to specify C language
support for the new features introduced into IEEE 754 since 1985. Most of the ISO/IEC 18661 series has
been incorporated into ISO/IEC 9899:2024 (also referred to as C23 because major work on this revision was
completed in 2023), which supports all required and most recommended features in IEEE 754-2019.
IEEE 754 defines alternatives for certain attributes of floating-point semantics, and aims to provide, through
programming languages, a means by which a program can specify which of the alternative semantics apply
to a given block of code. The program specification of attributes is constant (fixed at translation time), not
dynamic (changeable at execution time).
The FENV_ROUND and FENV_DEC_ROUND pragmas in C23 provide the rounding direction attributes required by
IEEE 754.
IEEE 754 also recommends other attributes that are not supported in C23, including:
— preferredWidth: evaluation formats for floating-point operations;
— value-changing optimizations: allow/disallow program transformations that can affect floating-point
result values;
— reproducibility: support for getting floating-point result values and exceptions that are exactly
reproducible on other systems;
— alternate exception handling: methods of handling floating-point exceptions.
To supplement the IEEE 754 support in C23, this document provides these recommended attributes by
means of standard pragmas. The pragma parameters represent the alternative semantics. The pragmas are
similar in form to the floating-point pragmas (FENV_ACCESS, FP_CONTRACT, CX_LIMITED_RANGE) that have been
in C since 1999.
© ISO/IEC 2025 – All rights reserved
v
Technical Specification ISO/IEC TS 18661-5:2025(en)
Programming languages, their environments, and system
software interfaces — Floating-point extensions for C —
Part 5:
Supplementary attributes
1 Scope
This document specifies extensions to programming language C to include pragmas corresponding to
attributes specified and recommended in ISO/IEC 60559 but not supported in ISO/IEC 9899:2024 (also
referred to as C23).
2 Normative references
The following documents, in whole or in part, are normatively referenced in this document and are
indispensable for its application. For dated references, only the edition cited applies. For undated references,
the latest edition of the referenced document (including any amendments) applies.
ISO/IEC 9899:2024, Information technology — Programming languages — C
ISO/IEC 60559:2020, Information technology — Microprocessor Systems — Floating-Point arithmetic
3 Terms and definitions
For the purposes of this document, the terms and definitions given in ISO/IEC 9899:2024 and
ISO/IEC 60559:2020 apply.
ISO and IEC maintain terminological databases for use in standardization at the following addresses:
— ISO Online browsing platform: available at https:// www .iso .org/ obp
— IEC Electropedia: available at https:// www .electropedia .org/
4 Conformance
An implementation that meets the requirements for a conforming implementation of C23 may conform to
any or all of the four feature sets in this document. The implementation conforms to the feature sets if
a) it defines __STDC_IEC_60559_BFP__ or __STDC_IEC_60559_DFP__ or both, indicating support for
ISO/IEC 60559 binary or decimal floating-point arithmetic, as specified in C23, Annex F;
and one or more of the following are true:
b) it defines __STDC_IEC_60559_ATTRIB_EVALUATION_FORMAT__ to 202401L and provides the features for
evaluation formats as specified in this document (Clause 7);
c) it defines __STDC_IEC_60559_ATTRIB_OPTIMIZATION__ to 202401L and provides the features for
optimization as specified in this document (Clause 8);
d) it defines __STDC_IEC_60559_ATTRIB_REPRODUCIBLE__ to 202401L and provides the features for
reproducibility as specified in this document (Clause 9);

© ISO/IEC 2025 – All rights reserved
e) it defines __STDC_IEC_60559_ATTRIB_ALTERNATE_EXCEPTION_HANDLING__ to 202401L and provides the
features for alternate exception handling as specified in this document (Clause 10).
5 C standard conformance
5.1 Freestanding implementations
C23, Clause 4 allows freestanding implementations to conform to this document.
5.2 Predefined macros
The implementation defines one or more of the following macros to indicate conformance to the specification
in this document for support of the corresponding attributes specified and recommended in ISO/IEC 60559.
__STDC_IEC_60559_ATTRIB_EVALUATION_FORMAT__ The integer constant 202401L.
__STDC_IEC_60559_ATTRIB_OPTIMIZATION__ The integer constant 202401L.
__STDC_IEC_60559_ATTRIB_REPRODUCIBLE__ The integer constant 202401L.
__STDC_IEC_60559_ATTRIB_ALTERNATE_EXCEPTION_HANDLING__ The integer constant 202401L.
5.3 Standard headers
The identifiers specified in this document are defined or declared by the associated header if and only if the
implementation defines the relevant feature macros (5.2) and
__STDC_WANT_IEC_60559_ATTRIB_EXT__
is defined as a macro at the point in the source file where the header is first included.
6 Standard pragmas
C23 provides standard pragmas (C23, 6.10.8) for specifying certain attributes pertaining to floating-point
behavior within a compound statement or file. This document extends this practice by introducing additional
standard pragmas to support attributes recommended by ISO/IEC 60559:
#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
width: specified with the pragmas (7.2, 7.3)
on-off-switch: specified in C23, 6.10.8
action, except-list: specified with the pragma (10.1)

© ISO/IEC 2025 – All rights reserved
7 Evaluation formats
7.1 General
This clause applies to implementations that define:
__STDC_IEC_60559_ATTRIB_EVALUATION_FORMAT__
C23 gives implementations the flexibility to evaluate operations to the format of the wider operand or to
a still wider evaluation format. The values of the macros FLT_EVAL_METHOD (C23, 5.3.5.3.3 and H.3) and
DEC_EVAL_METHOD (C23, 5.3.5.3.4 and H.3) characterize these evaluation methods. Though C23 does not
provide means for the user to control the evaluation method, some implementations provide such controls
as extensions. ISO/IEC 60559 recommends an attribute for this purpose. The following subclauses (7.2 and
7.3) specify pragmas in to control the evaluation method. These evaluation method pragmas, like
the FENV_ROUND (C23, 7.6.3) and FENV_DEC_ROUND (C23, 7.6.4) pragmas, affect translation-time expression
evaluation and constants.
NOTE As specified in C23, 6.7.2, the value of the initializer for an object declared with storage-class specifier
constexpr is constrained to be exactly representable in the target type. Thus, an evaluation method pragma whose
scope includes the declaration can affect the validity of the declaration.
7.2 Evaluation method pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_FLT_EVAL_METHOD width
Constraints
The width parameter shall be -1, 0, DEFAULT, or another value supported by the implementation.
Description
The FP_FLT_EVAL_METHOD pragma sets the evaluation method for standard floating types and for binary
interchange and extended floating types to the evaluation method represented by width. The parameter
width is an expression in one of the forms:
decimal-constant
- decimal-constant
DEFAULT
where the value of the expression is a possible value of the FLT_EVAL_METHOD macro, as specified in C23,
5.3.5.3.3 and H.3. An expression represents the evaluation method corresponding to its value (C23, 5.3.5.3.3
and H.3) and DEFAULT designates the implementation’s default evaluation method (characterized by the
FLT_EVAL_METHOD macro). The width parameter may be -1, 0, or DEFAULT. Which, if any, other values of width
are supported is implementation-defined. The pragma shall occur either outside external declarations or
preceding all explicit declarations and statements inside a compound statement. When outside external
declarations, the pragma takes effect from its occurrence until another FP_FLT_EVAL_METHOD pragma is
encountered, or until the end of the translation unit. When inside a compound statement, the pragma takes
effect from its occurrence until another FP_FLT_EVAL_METHOD pragma is encountered (including within
a nested compound statement), or until the end of the compound statement; at the end of a compound
statement the state for the pragma is restored to its condition just before the compound statement.

© ISO/IEC 2025 – All rights reserved
7.3 Evaluation method pragma for decimal floating types
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_DEC_EVAL_METHOD width
Constraints
The width parameter shall be -1, 1, DEFAULT, or another value supported by the implementation.
Description
The FP_DEC_EVAL_METHOD pragma sets the evaluation method for decimal interchange and extended floating
types to the evaluation method represented by width. The parameter width is an expression in one of the forms:
decimal-constant
- decimal-constant
DEFAULT
where the value of the expression is a possible value of the DEC_EVAL_METHOD macro, as specified in C23,
5.3.5.3.4 and H.3. An expression represents the evaluation method corresponding to its value (C23, 5.3.5.3.4
and H.3) and DEFAULT designates the implementation’s default evaluation method (characterized by the
DEC_EVAL_METHOD macro). The width parameter may be -1, 1, or DEFAULT. Which, if any, other values of width
are supported is implementation-defined. The pragma shall occur either outside external declarations or
preceding all explicit declarations and statements inside a compound statement. When outside external
declarations, the pragma takes effect from its occurrence until another FP_DEC_EVAL_METHOD pragma is
encountered, or until the end of the translation unit. When inside a compound statement, the pragma takes
effect from its occurrence until another FP_DEC_EVAL_METHOD pragma is encountered (including within
a nested compound statement), or until the end of the compound statement; at the end of a compound
statement the state for the pragma is restored to its condition just before the compound statement.
7.4 Effective evaluation method macros
The macros FLT_EVAL_METHOD (C23, 5.3.5.3.3 and H.3) and DEC_EVAL_METHOD (C23, 5.3.5.3.4 and
H.3) characterize the default evaluation method. Their values are constant expressions, suitable for use in
conditional expression inclusion preprocessing directives. They are not affected by the evaluation method
pragmas, so it is possible they do not reflect the effective evaluation method.
The header defines macros FLT_EVAL_METHOD_EFFECTIVE and DEC_EVAL_METHOD_EFFECTIVE that are
similar to the macros FLT_EVAL_METHOD and DEC_EVAL_METHOD, except that they characterize the
effective evaluation method at the point in the program where the macro is used. Thus, they reflect the state
of any evaluation method pragmas (7.2, 7.3) that are in effect. These macros shall not be used in conditional
expression inclusion preprocessing directives.
7.5 Evaluation type macros
The types with an _t suffix (e.g. float_t) (C23, 7.12.1 and H.11), which are defined to match
evaluation formats, reflect the evaluation method where no evaluation method pragma is in effect. For each
of these types, there is a type-like macro in with the same name which expands to a designation for
the type whose range and precision are used for evaluating operations and constants of the corresponding
standard, binary, or decimal floating type. The macro reflects the actual evaluation method, which can be
determined by an evaluation method pragma. Use of #undef to remove the macro definition will ensure that
the actual type is referred to (as though no evaluation method pragma was in effect).

© ISO/IEC 2025 – All rights reserved
7.6 Evaluation formats for
The evaluation methods in C23 apply to floating-point operators, but not to math functions. Hence, they do
not apply to the ISO/IEC 60559 operations that are provided as library functions. This subclause specifies
a macro the user can define to cause the generic macros in to be evaluated like floating-point
operators.
Except for functions that round result to a narrower type, if the macro
__STDC_TGMATH_OPERATOR_EVALUATION__
is defined at the point in the program where is first included, the format of the generic parameters
of the function invoked by a type-generic macro is the evaluation format determined by the effective
evaluation method (see C23, 5.3.5.3.3, 5.3.5.3.4 and H.3) applied to the types of the arguments for generic
parameters. The semantic type of the expanded type-generic macro is as determined by the rules in C23,
7.27 and H.13 and is unchanged by the evaluation method. Neither the arguments for generic parameters nor
the result are narrowed to their semantic types. Thus, (if the macro __STDC_TGMATH_OPERATOR_EVALUATION__
is appropriately defined) the evaluation method affects the operations provided by type-generic macros and
floating-point operators in the same way. See 7.6, EXAMPLE.
The macro __STDC_TGMATH_OPERATOR_EVALUATION__ does not alter the conversion of classification macro
arguments to their semantic types (as specified in C23, 7.12.4).
EXAMPLE The following code uses wide evaluation to avoid overflow and underflow.
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#define __STDC_TGMATH_OPERATOR_EVALUATION__
#include
{
#pragma STDC FLT_EVAL_METHOD 1 /* to double */
float x, y, z;
...
z = sqrt(x * x + y * y);
}
Because of the evaluation method pragma, the sum of squares, whose semantic type is float, is eval-
uated with the range and precision of double , hence does not overf low or underf low. The expand-
ed macro sqrt acquires the semantic type of its argument: float. However, because the macro
__STDC_TGMATH_OPERATOR_EVALUATION__ is defined before the inclusion of , the sqrt macro behaves
like an operator with respect to the evaluation method and does not narrow its argument to its semantic type. Without
the definition of the macro __STDC_TGMATH_OPERATOR_EVALUATION__, the sqrt macro would expand to sqrtf, and
its evaluated argument would be converted to float, which can overflow or underflow.
8 Optimization controls
8.1 General
This clause applies to implementations that define:
__STDC_IEC_60559_ATTRIB_OPTIMIZATION__
ISO/IEC 60559 recommends attributes to allow and disallow value-changing optimizations, individually and
collectively. C23, Annex F disallows value-changing optimizations, except for contractions (which can be
controlled as a group with the FP_CONTRACT pragma). This clause provides pragmas to allow or disallow
certain value-changing optimizations, including those mentioned in ISO/IEC 60559.
The pragmas in this clause can be used to allow the implementation to do certain floating-point optimizations
that are generally disallowed because the optimization can change values of floating-point expressions.
These pragmas apply to all floating types. It is unspecified whether optimizations allowed by these pragmas
occur consistently, or at all. These pragmas (among other standard pragmas) apply to user code. They do not
apply to code for operators or library functions that is placed inline by the implementation.

© ISO/IEC 2025 – All rights reserved
Some of the pragmas allow optimizations based on identities of real number arithmetic that are not valid
for floating-point arithmetic (C23, 5.2.2.4 and F.9.3). Optimizations based on identities that are valid for
the implementation’s floating-point arithmetic are always allowed. Optimizations based on identities
derived from identities whose use is allowed (either by a standard pragma or by virtue of being valid for the
implementation’s floating-point arithmetic) may also be done.
These pragmas do not affect the requirements on volatile or atomic variables.
Each pragma shall occur either outside external declarations or preceding all explicit declarations and
statements inside a compound statement. When outside external declarations, the pragma takes effect, on
each optimization it controls, from its occurrence until another pragma that affects the same optimization
is encountered, or until the end of the translation unit. When inside a compound statement, the pragma
takes effect, on each optimization it controls, from its occurrence until another pragma that affects the
same optimization is encountered (including within a nested compound statement), or until the end of the
compound statement; at the end of a compound statement the state for allowing each optimization controlled
by the pragma is restored to its condition just before the compound statement.
8.2 The FP_ALLOW_VALUE_CHANGING_OPTIMIZATION pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_VALUE_CHANGING_OPTIMIZATION on-off-switch
Description
This pragma is equivalent to all the optimization pragmas specified below, with the same value of on-off-
switch (ON, OFF, or DEFAULT).
NOTE The FP_ALLOW_VALUE_CHANGING_OPTIMIZATION pragma does not affect the evaluation methods.
Nevertheless, an evaluation method characterized by a negative value of width (C23, 5.3.5.3.3, 5.3.5.3.4 and H.3) can
allow for indeterminable evaluation formats, hence unspecified result values.
8.3 The FP_ALLOW_ASSOCIATIVE_LAW pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_ASSOCIATIVE_LAW on-off-switch
Description
This pragma allows or disallows optimizations based on the associative laws for addition and multiplication
x + (y + z) = (x + y) + z
x × (y × z) = (x × y) × z
where on-off-switch is one of
ON – allow application of the associative laws
OFF – do not allow application of the associative laws
DEFAULT – “off”
It should be noted that this pragma allows optimizations based on similar mathematical identities involving
subtraction and division. For example, for ISO/IEC 60559 floating-point arithmetic, since the identity
x − y = x + (−y)
© ISO/IEC 2025 – All rights reserved
is valid (C23, F.9.2), this pragma also allows optimizations based on
x + (y − z) = (x + y) − z
Similarly, if the states for this pragma and the FP_ALLOW_MULTIPLY_BY_RECIPROCAL pragma (8.5) are both
“on”, then optimizations based on the following are allowed:
x × (y / z) = (x × y) / z
It should also be noted that for ISO/IEC 60559 floating-point arithmetic, since the commutative laws
x + y = y + x
x × y = y × x
are valid, the pragma allows optimizations based on identities derived from the associative and commutative
laws, such as
x + (z + y) = (x + y) + z
8.4 The FP_ALLOW_DISTRIBUTIVE_LAW pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_DISTRIBUTIVE_LAW on-off-switch
Description
This pragma allows or disallows optimizations based on the distributive laws for multiplication and division
x × (y + z) = (x × y) + (x × z)
x × (y − z) = (x × y) − (x × z)
(x + y) / z = (x / z) + (y / z)
(x − y) / z = (x / z) − (y / z)
where on-off-switch is one of
ON – allow application of the distributive laws
OFF – do not allow application of the distributive laws
DEFAULT – “off”
8.5 The FP_ALLOW_MULTIPLY_BY_RECIPROCAL pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_MULTIPLY_BY_RECIPROCAL on-off-switch
Description
This pragma allows or disallows optimizations based on the mathematical equivalence of division and
multiplication by the reciprocal of the denominator
x / y = x × (1 / y)
© ISO/IEC 2025 – All rights reserved
where on-off-switch is one of
ON – allow multiply by reciprocal
OFF – do not allow multiply by reciprocal
DEFAULT – “off”
8.6 The FP_ALLOW_ZERO_SUBNORMAL pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_ZERO_SUBNORMAL on-off-switch
Description
This pragma allows or disallows replacement of subnormal operands and results by zero, where on-off-
switch is one of
ON – allow replacement of subnormals with zero
OFF – do not allow replacement of subnormals with zero
DEFAULT – “off”
Within the scope of this pragma, the floating-point operations affected by the pragma are all floating-point
operators, implicit conversions (including the conversion of a value represented in a format wider than its
semantic type to its semantic type, as done by classification macros), and invocations of applicable functions
in , , , and for which macro replacement has not been suppressed
(C23, 7.1.4). Thus, subnormal operands and results of affected operations may be replaced by zero. Whether
the replacement raises the “inexact” and “underflow” floating-point exceptions is unspecified. Functions not
affected by the pragma behave as though no FP_ALLOW_ZERO_SUBNORMAL pragma were in effect at the site of
the call.
8.7 The FP_ALLOW_CONTRACT_FMA pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_CONTRACT_FMA on-off-switch
Description
This pragma allows or disallows contraction (C23, 6.5.1) of floating-point multiply and add or subtract (with
the result of the multiply)
x * y + z
x * y − z
x + y * z
x − y * z
where on-off-switch is one of
ON – allow contraction for floating-point multiply-add
OFF – do not allow contraction for floating-point multiply-add

© ISO/IEC 2025 – All rights reserved
DEFAULT – implementation defined whether “on” or “off”
NOTE ISO/IEC 60559 uses the term “synthesize” instead of “contract”.
8.8 The FP_ALLOW_CONTRACT_OPERATION_CONVERSION pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_CONTRACT_OPERATION_CONVERSION on-off-switch
Description
This pragma allows or disallows contraction (C23, 6.5.1) of a floating-point operation and a conversion (of
the result of the operation), where on-off-switch is one of
ON – allow contraction for floating-point operation-conversion
OFF – do not allow contraction for floating-point operation-conversion
DEFAULT – implementation defined whether “on” or “off”
Within the scope of this pragma, the floating-point operations affected by the pragma are all floating-point
operators, implicit conversions (including the conversion of a value represented in a format wider than its
semantic type to its semantic type, as done by classification macros), and invocations of applicable functions
in , , , and for which macro replacement has not been suppressed
(C23, 7.1.4). Thus, an affected operation may be contracted with a conversion of its result. Functions not
affected by the pragma behave as though no FP_ALLOW_CONTRACT_OPERATION_CONVERSION pragma were in
effect at the site of the call.
EXAMPLE For the code sequence
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_CONTRACT_OPERATION_CONVERSION ON
float f1, f2;
double d1, d2;

f1 = d1 * d2;
f2 = sqrt(d1);
the multiply (operation) and assignment (conversion) can be evaluated with just one rounding (to the range
and precision of float). If the on-off-switch for the pragma were OFF, then the multiply would be rounded
according to the evaluation method and the assignment would entail a second rounding. With the given
code, the sqrt function can be replaced by fsqrt, avoiding the need for a separate operation to convert the
double result of sqrt to float.
8.9 The FP_ALLOW_CONTRACT pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_ALLOW_CONTRACT on-off-switch
Description
This pragma allows or disallows contraction (C23, 6.5.1) for floating-point operations, where on-off-switch
is one of
ON – allow contraction for floating-point operations

© ISO/IEC 2025 – All rights reserved
OFF – do not allow contraction for floating-point operations
DEFAULT – implementation defined whether “on” or “off”
The optimizations controlled by this pragma include those controlled by the FP_ALLOW_CONTRACT_FMA and
FP_ALLOW_CONTRACT_OPERATION_CONVERSION pragmas.
This pragma is equivalent to the FP_CONTRACT pragma (C23, 7.12.3), also in : the two pragmas may
be used interchangeably, provided the implementation defines __STDC_WANT_IEC_60559_ATTRIB_EXT__.
9 Reproducibility
9.1 General
This clause applies to implementations that define
__STDC_IEC_60559_ATTRIB_REPRODUCIBLE__
ISO/IEC 60559 recommends an attribute to facilitate writing programs whose floating-point results and
exception flags will be reproducible on any implementation that supports the language and library features
used by the program. Such code must use only those features of the language and library that support
reproducible results. These features include ones with a well-defined binding to reproducible features of
ISO/IEC 60559, so that no unspecified or implementation-defined behavior is admitted.
This clause provides a pragma to support the ISO/IEC 60559 attribute for reproducible results and gives
requirements for programs to have reproducible results. Where the state of the pragma is “on”, floating-
point numerical results and exception flags are reproducible (given the same inputs, including relevant
environment variables) on implementations that define
__STDC_IEC_60559_ATTRIB_REPRODUCIBLE__
and that support the language and library features used by the source code, provided the source code uses a
limited set of features as described below (9.3).
An implementation that defines __STDC_IEC_60559_ATTRIB_REPRODUCIBLE__ also defines either
__STDC_IEC_60559_BFP__ or __STDC_IEC_60559_DFP__, or both. If the implementation defines
__STDC_IEC_60559_BFP__, it supports reproducible results for code using (binary) types float and double. If
the implementation defines __STDC_IEC_60559_DFP__, it supports reproducible results for code using types
_Decimal32, _Decimal64, and _Decimal128. If the implementation defines __STDC_IEC_60559_TYPES__, then it
supports reproducible results for code using its interchange floating types (C23, H.2.2). If the implementation
provides a set of correctly rounded math functions (C23, 7.33.9), then it supports reproducible results for
code using correctly rounded math functions from that set.
9.2 The FP_REPRODUCIBLE pragma
Synopsis
#define __STDC_WANT_IEC_60559_ATTRIB_EXT__
#include
#pragma STDC FP_REPRODUCIBLE on-off-switch

© ISO/IEC 2025 – All rights reserved
Description
This pragma enables or disables support for reproducible results. The pragma shall occur either outside
external declarations or preceding all explicit declarations and statements inside a compound state-
ment. When outside external declarations, the pragma takes effect from its occurrence until another
FP_REPRODUCIBLE pragma is encountered, or until the end of the translation unit. When inside a compound
statement, the pragma takes effect from its occurrence until another FP_REPRODUCIBLE pragma is encountered
(including within a nested compound statement), or until the end of the compound statement; at the end of a
compound statement the state for the pragma is restored to its condition just before the compound statement.
If the state of the pragma is “on”, then the effects of the following are implied:
#pragma STDC FENV_ACCESS ON
#pragma STDC FP_ALLOW_VALUE_CHANGING_OPTIMIZATION OFF
and if __STDC_IEC_60559_BFP__ is defined
#pragma STDC FP_FLT_EVAL_METHOD 0
and if __STDC_IEC_60559_DFP__ is defined
#pragma STDC FP_DEC_EVAL_METHOD 1
If the FP_REPRODUCIBLE pragma appears with the on-off-switch OFF under the effect of a FP_REPRODUCIBLE
pragma with on-off-switch ON, then the states of the FENV_ACCESS pragma, the value-changing optimization
pragmas, and the evaluation method pragmas (even an evaluation method pragma whose state was
explicitly changed under the effect of the pragma with on-off-switch ON) revert to their states prior to the
FP_REPRODUCIBLE pragma with on-off-switch ON. The FP_REPRODUCIBLE pragma with on-off-switch OFF has no
effect if it occurs where the state of the pragma is “off”.
The default state of the pragma is “off”.
Recommended practice: The implementation is encouraged to issue a diagnostic message if, where the state
of the FP_REPRODUCIBLE pragma is “on”, the source code uses a language or library feature whose results may
not be reproducible.
9.3 Reproducible code
1)
The following properties support code sequences in producing reproducible results.
— The code is under the effect of the FP_REPRODUCIBLE pragma (with state “on”).
— All floating-point operations used by the code are bound to ISO/IEC 60559 operations, as described in
C23, F.3 in Table F.2.
— The code does not contain any use that may result in undefined behavior. The code does not depend on
any behavior that is unspecified, implementation-defined, or locale-specific.
The restrictive properties below are examples, not a complete list. See also C23, Annex J. Although
the properties may not be necessary in all cases for reproducible code, the user is advised to follow the
restrictions to avoid common programming practices that would undermine reproducibility.
— The code does not use the long double type.
— The code does not use complex or imaginary types.
1) Of course, if the code uses optional features, results will be reproducible only on implementations that support those
features.
© ISO/IEC 2025 – All rights reserved
— If __STDC_IEC_60559_BFP__ is not defined by the implementation, the code does not use the float or
double types.
— Even if __STDC_IEC_60559_TYPES__ is defined, the code does not use extended floating types. (Even if
__STDC_IEC_60559_TYPES__ is defined, some interchange floating types are optional features.)
— The code does not depend on the payloads (C23, F.10.14) or sign bits of quiet NaNs.
— The code does not use signaling NaNs.
— The code does not depend on conversions between binary floating types and character sequences with
more than M + 3 significant decimal digits, where M is 17 if __STDC_IEC_60559_TYPES__ is not defined (by
the implementation), and M is 1 + p×log(2) , where p
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...

Die ISO/IEC TS 18661-5:2025 behandelt wichtige Erweiterungen der Programmiersprache C, die sich auf die Einführung von Pragmas beziehen, welche den in ISO/IEC 60559 speicherbaren Attributen entsprechen, jedoch in der aktuellen Version ISO/IEC 9899:2024 (C23) nicht unterstützt werden. Diese Standardisierung ist von erheblicher Bedeutung, da sie es Programmierern ermöglicht, eine präzisere Kontrolle über die Handhabung von Gleitkommazahlen zu erlangen. Ein zentrales Merkmal der ISO/IEC TS 18661-5:2025 ist die klare Definition der zusätzlicher Attribute, was nicht nur die Flexibilität der Programmiersprache erhöht, sondern auch die Programmierungsicherheit verbessert. Durch die Einführung dieser pragmatischen Vorschriften wird sichergestellt, dass Gleitkommaoperationen konsistent und gemäß den spezifizierten Anforderungen durchgeführt werden können, was insbesondere für Anwendungen von Bedeutung ist, die hohe Präzision in der numerischen Berechnung erfordern. Ein weiterer Vorteil des Standards liegt in seiner Relevanz für moderne Softwareentwicklung, da eine Vielzahl von Anwendungen auf präzise Gleitkommaoperationen angewiesen ist, insbesondere in Bereichen wie Datenanalyse, wissenschaftliche Berechnungen und maschinelles Lernen. Die Anpassung der Programmiersprache C an diese spezifischen Bedürfnisse durch die ISO/IEC TS 18661-5:2025 fördert die Einsatzmöglichkeiten und erhöht die Leistungsfähigkeit von C-basierten Anwendungen. Zusammenfassend lässt sich sagen, dass die ISO/IEC TS 18661-5:2025 ein unverzichtbares Werkzeug für Entwickler darstellt, die bei der Programmierung mit C auf die Vorteile pragmatischer Attribute zur Unterstützung von Gleitkommaoperationen zugreifen möchten. Die klaren Spezifikationen und Empfehlungen stärken die Relevanz dieser Erweiterung in der heutigen technologischen Landschaft.

La norme ISO/IEC TS 18661-5:2025 se concentre sur l'extension du langage de programmation C en introduisant des pragmas qui correspondent à des attributs spécifiés et recommandés dans la norme ISO/IEC 60559, mais qui ne sont pas supportés dans la norme ISO/IEC 9899:2024, communément appelée C23. L'étendue de cette norme est cruciale pour les développeurs et les systèmes qui dépendent de la manipulation de nombres à virgule flottante, car elle garantit une plus grande cohérence et compatibilité dans les environnements de programmation. En fournissant des instructions spécifiques pour l'implémentation de ces attributs, la norme permet aux programmeurs d'accéder à des fonctionnalités avancées sans compromettre la portabilité du code C. Parmi les forces notables de la norme ISO/IEC TS 18661-5:2025, on trouve la clarté dans la spécification des extensions, ainsi qu'une attention particulière aux besoins accrus de précision et de performance dans les applications modernes. En répondant aux demandes spécifiques de l'industrie pour des fonctionnalités de virgule flottante, cette norme renforce la pertinence du langage C dans les domaines d'application scientifique et technique. De plus, la norme contribue à l’évolution de C, en garantissant que les développeurs peuvent continuer à tirer parti d’innovations récentes tout en maintenant la compatibilité avec les bases de code existantes. Cette approche favorise la continuité et l'adoption des meilleures pratiques dans le développement de logiciels, consolidant ainsi la position de C comme un langage fiable et évolutif dans le paysage de la programmation contemporaine.

ISO/IEC TS 18661-5:2025は、プログラミング言語Cの拡張に関する重要な文書であり、この標準が提供する範囲は特に関心を引きます。このドキュメントは、ISO/IEC 60559で指定され、推奨される属性に対応するプラグマを含むC言語の拡張を詳述しており、ISO/IEC 9899:2024(C23としても知られる)ではサポートされていない機能を補完しています。 この標準の強みは、プログラミング言語の進化に対応するための高度な機能を追加する能力にあります。特に、浮動小数点の扱いにおいて、Cの環境における精度とパフォーマンスを向上させるための柔軟性を提供しています。これにより、開発者はより専門的なアプリケーションを効率的に構築することが可能になります。 また、ISO/IEC TS 18661-5:2025は、プログラミング言語Cの標準化を進める重要なステップであり、国際的に認められた基準をもとに、開発者が一貫した環境で作業できることを保証します。このような標準は、特に教育研究や商業アプリケーションにおいて重要な役割を果たします。 さらに、浮動小数点拡張に関する標準化は、特に科学計算や工学的応用において正確な数値解析が求められるため、非常に関連性が高いといえます。これにより、C言語の利用範囲が広がり、さまざまな業界でのニーズに応えることが期待されます。 総じて、ISO/IEC TS 18661-5:2025は、技術的な進歩を反映し、プログラミング言語Cの標準化の一環としての意義を持つ非常に重要な文書です。

ISO/IEC TS 18661-5:2025는 프로그래밍 언어 C의 확장을 정의하여 ISO/IEC 60559에서 지정된 속성과 권장 사항에 해당하는 프라그마를 포함하고 있습니다. 이 문서는 ISO/IEC 9899:2024(C23)에서 지원되지 않는 보조 속성을 다루며, 이러한 확장은 C 언어 환경 및 시스템 소프트웨어 인터페이스에 있어 중요한 역할을 합니다. 이 표준의 강점은 C 언어의 이식성과 정확성을 높이는 것에 있습니다. 특히 부동소수점 수학을 수행하는 복잡한 소프트웨어 시스템에서 C 언어의 활용성을 높여 주며, 다양한 플랫폼 간의 일관성을 유지할 수 있도록 도와줍니다. 보조 속성을 추가함으로써 개발자는 보다 유연한 프로그래밍을 할 수 있으며, 성능 최적화와 관련된 문제를 해결하는 데 기여할 수 있습니다. ISO/IEC TS 18661-5:2025의 범위는 현대 소프트웨어 개발에서 중요한 요소인 데이터의 정확성 및 처리 성능을 향상시키는 데 중점을 두고 있으며, 이는 특히 과학적 계산이나 고성능 컴퓨팅 분야에서 매우 중요합니다. 이러한 표준화 문서는 개발자들이 C 언어를 사용할 때 보다 세밀한 제어와 진보된 기능을 제공하여, 궁극적으로는 소프트웨어의 신뢰성을 강화하고, 다양한 산업 분야에 걸쳐 폭넓은 응용을 가능하게 합니다. 이러한 이유로, ISO/IEC TS 18661-5:2025는 프로그래머와 시스템 소프트웨어 엔지니어들에게 큰 도움이 되는 필수 문서로 평가되며, C 언어의 미래 발전 방향을 제시하는 중요한 기준으로 자리잡고 있습니다.

The document ISO/IEC TS 18661-5:2025 represents a crucial development in the standardization of programming languages, specifically focusing on the C programming language and its interaction with floating-point arithmetic. The scope of this standard is clearly defined as it specifies extensions to the C language, introducing pragmas that correspond to supplementary attributes as outlined in ISO/IEC 60559. This addition addresses the gaps present in ISO/IEC 9899:2024 (C23), which does not support these specific floating-point extensions. One of the strengths of this standard is its emphasis on improving accuracy and reliability in floating-point computations. By incorporating these supplementary attributes, developers gain the ability to better manage floating-point behavior in their applications, which is particularly valuable in performance-critical systems and scientific computing environments. The recommended pragmas serve as a powerful tool for optimization, allowing programmers to fine-tune their code to achieve more predictable and efficient results. Moreover, the relevance of ISO/IEC TS 18661-5:2025 in today's programming landscape cannot be overstated. As applications increasingly rely on accurate floating-point arithmetic for data processing and computation, the inclusion of these extensions supports modern software development practices. The standard ensures that programmers can write code that adheres to globally recognized guidelines, thus enhancing portability and interoperability among different systems and platforms. In summary, ISO/IEC TS 18661-5:2025 significantly advances the capabilities of the C programming language in handling floating-point numbers, providing essential tools that align with contemporary computational requirements. Its strengths in accuracy, optimization, and relevance to current standards make it an invaluable resource for developers seeking to enhance their programming practices.