Submitter:CFP group
Submission Date: 2021-06-06
Document: WG14 N2754
Title: N2754: DFP: Quantum exponent of NaN (version 2)
Reference Documents: N2596, N2642, IEEE 754-2019

Note: This is an update of N2642.

Summary: Q(x) is used to denote the quantum exponent of decimal floating-point x. Q(infinity) is defined as infinity. Some math functions make reference to Q(NAN). However, Q(NAN) is not defined in either C23 or IEEE 754-2019.

5.2.4.2.3 paragraph 9 says the preferred quantum exponent is specified by IEEE 754-2019 which has:

9.2.2 Preferred exponents:
The preferred exponent for operations in sub-clause 9.2 is 0, except for the following: ...

The table of Preferred quantum exponents in paragraph 10 of 5.2.4.2.3 makes reference to Q(x) and preferred quantum exponent of the result.

There are five cases where a NaN operand does not produce a NaN result for math functions. While the result's value is defined, the quantum exponent of that result is not well defined -- mainly because Q(NAN) is not defined.

There are many cases where an infinity operand does not produce an infinity result for math functions. While the result's value is defined, the quantum exponent of that result is sometimes not well defined -- mainly because zero*infinity is not defined.

These appear to be defects in IEEE 754-2019 as Q(NAN) is not defined, nor is Q(zero*infinity) defined.

Suggested changes to C23: Change 5.2.4.2.3, paragraph 10 from:

The following table shows, for each operation delivering a result in decimal floating-point format, how the preferred quantum exponents of the operands, Q(x), Q(y), etc., determine the preferred quantum exponent of the operation result.
to
The following table shows, for each operation delivering a result in decimal floating-point format, how the preferred quantum exponents of the operands, Q(x), Q(y), etc., determine the preferred quantum exponent of the operation result., provided the table formula is defined for the arguments. For the cases where the formula is undefined and the function result is +/-infinity, the preferred quantum exponent is immaterial because the quantum exponent of +/- infinity is defined to be infinity. For the other cases where the formula is undefined and the function result is finite, the preferred quantum exponent is unspecified.*)

*) Although unspecified in IEC 60559, a preferred quantum exponent of 0 for these cases would be a reasonable implementation choice.