[Cfp-interest] 18661-2 and 754

Jim Thomas jaswthomas at sbcglobal.net
Sat May 12 20:14:13 PDT 2018



> On Feb 19, 2018, at 8:59 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> 18661-2 quantize has
>  Nothing about non-canonical encodings.  

We need a general statement about functions delivering canonical results unless specified otherwise. We say this implicitly through the binding with IEC 60559, but it would be good say it explicitly. It could go in part 1, which introduces the concept of canonical representations into C. 5.2.4.2.2#5a ends with: "Typically, floating-point operations deliver results with canonical representations.” We could append something like: “IEC 60559 operations deliver results with canonical representations, unless specified otherwise." 

>  Nothing about overflow.

The last sentence of the Description could say: The quantize functions do not raise the ”overflow” or “underflow” floating-point exception.

>  Nothing about 'invalid' (which would be in Annex F).

The decimal functions are intended to be specified in 7.12 to have IEC 60559 behavior. That is, all implementations that choose to provide them must follow IEC 60559. This means we should be able to give the entire specification in 7.12 without saying anything more in Annex F. Note that the Description of the quantize functions states the requirement for” inexact". It could do the same for “invalid":

[2] The quantizedN functions compute, if possible, a value with the numerical value of x and the quantum exponent of y. If the quantum exponent is being increased, the value shall be correctly rounded; if the result does not have the same value as x, the “inexact” floating-point exception shall be raised. If the quantum exponent is being decreased and the significand of the result has more digits than the type would allow, the result is NaN, the “invalid” floating-point exception is raised, and a domain error occurs. If one or both operands are NaN the result is NaN. Otherwise if only one operand is infinite, the result is NaN, the “invalid” floating-point exception is raised, and a domain error occurs. If both operands are infinite, the result is DEC_INFINITY with the sign of x, converted to the type of the function. The quantize functions do not raise the”overflow” or “underflow” floating-point exceptions.



> 754 has in 5.3.2
> ...this operation shall not propagate non-canonical encodings:
> quantize does not signal underflow or overflow.
> Otherwise if only one operand is infinite then the invalid operation
> exception is signaled and the result is a NaN.
> 
> 18661-2 llquantexp has
>  Nothing about 'invalid' for infinite and NaN (which would be in Annex F).

Following the approach above:

[2] The llquantexpdN functions compute the quantum exponent (5.2.4.2.2a) of a finite argument. If x is infinite or NaN, they compute LLONG_MIN, the “invalid” floating-point exception is raised, and a domain error occurs.

- Jim Thomas

> 
> 
> ---
> 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.
> 
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20180512/8a98a668/attachment.html 


More information about the Cfp-interest mailing list