[Cfp-interest 1890] Re: Quantum exponent of NaN

Jim Thomas jaswthomas at sbcglobal.net
Tue Jan 12 11:21:21 PST 2021



> On Dec 26, 2020, at 8:55 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> Attached is a first pass at the Q(NAN) issue.
> 
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com <mailto: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 <http://www.tybor.com/>
> Savers sleep well, investors eat well, spenders work forever.
> 
> 
> Submitter:CFP group
> Submission Date: 2021-??-??
> Document: WG14 26zz
> Title: 26zz: 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. 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))).
Q will be 0 regardless of 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)).
Inf is the only quantum exponent of Inf, so Q(NaN) doesn’t matter here.
> 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)).
q = 0 is best because it indicates the least accuracy.
> 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)).
q = 0 is best. Formula gives Q(pow(x, 0)) = 0 for all finite x. 

What about q for pow(Inf, 0) = 1? Again, 0 is best, though formula floor(y*Q(x)) isn’t defined. This case has no NaN operand.
> 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)).
Again, 0 is best.

Claim: The table gives the preferred quantum exponent where the formula is defined.
> This appears to be a defect 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 non-NaNoperands, Q(x), Q(y), etc., determine the preferred quantum exponent of the operation result. A finite result from a NaN operand has a preferred quantum exponent of zero. An infinite result from a NaN operand has a preferred quantum exponent of infinity.
Consider

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 operand has a preferred quantum exponent of 0. 

- Jim Thomas

> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net <mailto:Cfp-interest at oakapple.net>
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest <http://mailman.oakapple.net/mailman/listinfo/cfp-interest>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20210112/3b8eddb2/attachment-0001.htm>


More information about the Cfp-interest mailing list