[Cfp-interest 3139] Reorganization of Annex G content

Jim Thomas jaswthomas at sbcglobal.net
Mon Jul 15 11:27:24 PDT 2024


This is about moving parts of Annex G that are not particularly related to ISO/IEC 60559 out of the annex and into the main body of the C standard. The obvious parts to move are the definitions for multiplicative operators in G.5.2 paragraphs 1-3, and the definitions for additive operators in G.5.3 paragraphs 1 and 2. 

These definitions support ISO/IEC 60559 consistent behavior for signed zeros and infinities, but the same definitions give the natural, most efficient implementation of the operators +, -, *, and / with operands of mixed type domains (real and complex) for all implementations.

Though C23 allows implementations to use the formulas in these definitions, doing so is not currently required outside of Annex G, and users can’t depend on it.

In the following the subclause numbering refers to C2Y working draft N3220. 

To 6.2.5 paragraph 17, append:

In this document complex values are sometimes written in the form x + i y, where x and y are the values of the real and imaginary parts. The form x - i y represents x + i (-y).

In 6.5.6 under Semantics insert

If one operand is real with value x and the other operand is complex with value u + i v, the product is defined by (x * u) + i (x * v).

If the first operand is complex with value x + i y and the second operand is real with value u, the quotient is defined by (x / u) + i (y / u).

In 6.5.7 under Semantics insert:

If one operand is real with value x and the other operand is complex with value u + i v, the sum is defined by (x + u) + i v.

If the first operand is real with value x and the second operand in complex with value u + i v, the difference is defined by (x - u) + i (-v).

If the first operand is complex with value x + i y and the second operand is real with value u, the difference is defined by (x - u) + i y.

Additional changes are needed to remove the definitions using tables from G.5.2 and G.5.3. Detailed changes to Annex G can be provided more effectively when the change to remove imaginary types has been done.

- Jim


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20240715/92f0e7a4/attachment.htm>


More information about the Cfp-interest mailing list