Submitter: Joseph Myers
Submission Date: 2013/07/21
Source: WG 14
Reference Document: N1730
Date: April 2014
Subject: Floating-point issues in C11 from PDTS 18661-1 UK review, Issue 2
SummarySome issues with floating point in C11 have been identified as part of the UK review of the N1711 draft of TS 18661-1. While such issues relate to the general area of C bindings to IEC 60559:2011, and so could be addressed in the TS on that basis, since the issues also apply to C11 as-is it may be more appropriate to address some or all of these issues as Defect Reports with a view to having a normative fix in a future TC to C11 rather than only having a fix in conjunction with the new bindings.
Issue 2: Definition of FLT_ROUNDS
The C11 definition of FLT_ROUNDS is inadequate in that it refers to floating-point addition but does not say addition of what type. If long double is not an IEC 60559 type, it may not fully support all rounding modes even though they are supported by other types. (This is an actual issue with real implementations using non-IEC 60559 types for long double.) A suitable fix would be:
In 184.108.40.206.2#8, insert "for type float" after "floating-point addition". At the end of F.2#1, insert "The value of FLT_ROUNDS applies to all IEC 60559 types supported by the implementation, but may not apply to non-IEC 60559 types.".
Proposed Committee Response
- The committee regards the existing definition of FLT_ROUNDS as intended to apply to type float, type double and long double.
- Restricting it, as the author suggests, would likely break existing implementation definitions, and be of little to no end programmer benefit.
- Moreover, in F.2 the three values are already implied to be 60559 compliant.
- As such, the committee does not regard this as a defect and recommends no change.
Previous Defect Report < - > Next Defect Report