[Cfp-interest 1965] Q(NAN) and Q(0*inf)
Fred J. Tydeman
tydeman at tybor.com
Sun Apr 11 06:04:26 PDT 2021
On Thu, 25 Mar 2021 08:45:23 -0600 Rajan Bhakta wrote:
>
> Fred: Send the IEEE 754 errata note that is currently not reflected
>in the errata list to the CFP group.
Attached.
---
Fred J. Tydeman Tydeman Consulting
tydeman at tybor.com Testing, numerics, programming
+1 (702) 608-6093 Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.
-------------- next part --------------
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.
* compoundn(NAN,0) -- F.10.4.2 says value is 1. The table in
5.2.4.2.3 says its quantum exponent is floor(0*min(0,Q(NAN))).
* hypot(+/-INFINITY,NAN) -- F.10.4.4 says value is +INFINITY. The
table in 5.2.4.2.3 says its quantum exponent is
min(Q(+/-INFINITY),Q(NAN)).
* pow(1,NAN) -- F.10.4.5 says value is 1. The table in 5.2.4.2.3
says its quantum exponent is floor(NAN*Q(1)).
* pow(NAN,0) -- F.10.4.5 says value is 1. The table in 5.2.4.2.3
says its quantum exponent is floor(0*Q(NAN)).
* pown(NAN,0) -- F.10.4.6 says value is 1. The table in 5.2.4.2.3
says its quantum exponent is floor(0*Q(NAN)).
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.
* pow(1,infinity) -- F.10.4.5 says value is 1. The table in
5.2.4.2.3 says its quantum exponent is floor(infinity*Q(1)) --
which could be infinity*zero.
* pow(infinity,0) -- F.10.4.5 says value is 1. The table in
5.2.4.2.3 says its quantum exponent is floor(0*Q(infinity)) --
which is zero*infinity.
* pown(infinity,0) -- F.10.4.6 says value is 1. The table in
5.2.4.2.3 says its quantum exponent is floor(0*Q(infinity)) --
which is zero*infinity.
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[DEL: . :DEL]
[INS: , 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: :INS]
[INS: A finite result from a NaN or infinity operand has a
preferred quantum exponent of 0. :INS]
More information about the Cfp-interest
mailing list