Submitter: Fred Tydeman (USA)
Submission Date: 2006-12-12
Source: WG 14
Reference Document: ISO/IEC WG14 N1203
Subject:Missing semantics of comparison macros
Section 7.12.14 Comparison macros (and subsections) are missing Semantics. In particular, something along the lines of: "The usual arithmetic conversions are performed on the operands." This matters if the two operands are of different type, e.g., isless(4.f/3.f,4.L/3.L).
In addition, we might need to add something alone the lines of: "The result of the ... operator is ..." to each of the subsections. We should consider section 6.5.8 Relational operators when we process this defect.
We should review the Constraints of 6.5.* and consider adding something along the lines of: "Each of the operands shall have real floating-type." to 7.12.14 as a constraint. The example in 220.127.116.11 paragraph 4 which uses sizeof will not work when float and _Decimal32 are the same size; nor for double and _Decimal64 being the same size.
Suggested Technical Corrigendum
Proposed Technical Corrigendum
Committee Discussion (for history only)
There seem to be consensus that the comparison functions are under-specified.
The Standard currently says:
In the synopses in this subclause, real-floating indicates that the argument shall be an expression of real floating type.This is well defined, see 6.2.5 para 10. However, several in attendance believe there should be explicit language explaining whether or not the two arguments to a comparison macro must be the same real-floating type or allowed to be different real-floating type.
It as also asked for the following to be added to the committee discussion:
IEEE-754 (and IEEE-754R) require that comparison operations work in all supported formats, even if the operands' format differ. C99+TC1+TC2, Annex F.3, printed page 445, first bullet says that the comparison macros (along with the relational and equality operators) are the IEC 60559 comparisons.
This work could possibly fit into the type generic/overloading project that needs to be completed for C1X.
This issue will be addressed in a future revision of the C standard. See WG 14 document Nxxx.
Previous Defect Report < - > Next Defect Report