Submitter:CFP group
Submission Date: 2021-01-24
Document: WG14 N2642
Title: N2642: Quantum exponent of NaN
Reference Documents: N2596, IEEE 754-2019

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.

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.

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. Cases where the formula is undefined (because of infinities and NaNs) are covered by the observation that an infinite result always has a quantum exponent of infinity (so its preferred quantum exponent is immaterial), and the additional rule:

A finite result from a NaN or infinity operand has a preferred quantum exponent of 0.