[Cfp-interest 2996] Re: about C26 Issue 1

Jim Thomas jaswthomas at sbcglobal.net
Tue Feb 6 14:50:34 PST 2024


Some followup, including suggestion for how to proceed ...

> On Feb 5, 2024, at 9:49 AM, Jim Thomas <jaswthomas at sbcglobal.net> wrote:
> 
> Some thoughts related to Issue 1 in https://wiki.edg.com/pub/CFP/WebHome/C26C.HTM ...
> 
> Back to the definitions of errors. 7.12.1 says:
> 
> … a domain error occurs if and only if an input argument is outside the domain over which the mathematical function is defined. 
> 
> and 
> 
> … a pole error (also known as a singularity or infinitary) occurs if and only if the mathematical function has an exact infinite result as the finite input argument(s) are approached in the limit (for example, log(0.0)).
> 
> Domain and pole errors are defined in terms of mathematical functions. The pole error definition obscures this fact by referring to “an exact infinite result”, though “exact” isn’t applicable to mathematical function results. (Note that  log(0.0) is in program font, which is appropriate: a pole error occurs for the execution of log(0.0) because the mathematical function log(x) has a pole at 0.)
> 
> Does the mathematical function’s range include an infinity? The domain error definition doesn’t say, but if an infinity were not included, a domain error would occur for log(0.0). The pole error definition implies the mathematical function’s range does include an infinity, and the parenthetical example says a pole error occurs for log(0.0). 
> 
> I think the mathematical functions should have the range of the extended real numbers, i.e. of the real numbers together with infinity. Then poles are at points within the domain, and log(0.0) causes a pole error and not a domain error, as I believe is the general understanding.

1a Suggest we review these definitions with an eye toward rewording them to clarify that the mathematical functions include infinity. 

For the pole error definition, maybe “… if and only if the mathematical function has an infinite value where a finite argument *) is approached in the limit.” where the footnote is:

*) For a function of n variables "a finite argument" is intended to mean an n-tuple of finite arguments.

> 
> Unlike domain and pole errors, range errors are defined in terms of implementation limitations. This seems right, because range errors are about limitations of the approximation, not about the mathematical function.
> 
> For some math library functions, it’s may not be clear what the mathematical function is, e.g. atan2, and logb. For pow the mathematical function might appear to be x^y but IEC 60559 defines pow for some cases where x^y is undefined, e.g. pow(0, 0) = 1, thus the mathematical function corresponding to pow is a piecewise function. 

1b Suggest we consider how to clarify what is meant by "the mathematical function".

> 
> 7.12.1 says “The description of each function lists any required domain/pole/range errors”. I think CFP agreed that this means these are the errors that are required to be reported (via errno or exceptions),

Not quite right. Underflow range errors are not required to be reported. For underflow, a required range error would mean one where whether it is reported is implementation defined.
.
> but his meaning is not clear in the standard. We should consider proposing a clarification.

1c Suggest we consider how to clarify what is meant by "required error".
> 
> 7.12.1 says the implementation is free to report domain/pole/range errors in other cases, provided the definition of the error fits. Given this, what is the intended meaning of, “a domain/pole/range error may occur” in a function description? It might just note a case that fits the definition of the error for which the implementation may (but is not required to) report the error. Or it might mean the definition fits for some implementations but not for others. Or it might mean that the implementation can determine whether the definition fits. 

1d Suggest we review function by function (including tgamma and lgamma) what “error may occur” is intended to mean. Then consider how to clarify what “error may occur” means (or use other words).

> 
> An error can't be required unless IEC 60559 allows a corresponding floating-point exception. For example, a non-IEC 60559 implementation might regard atan2(0, 0) to be a domain error. However, IEC 60559 defines the result and does not allow an “invalid” floating-point exception in this case. Thus, IEC 60559 implementations can not be allowed to report atan2(0, 0) as a domain error. 

I meant “ … can not be required to report …”. This is just a reminder of the constraint on the specification.

The handing of overflow is different for errno and exceptions. Was that a legacy case?

- Jim Thomas

> 
> These are not “easy” issues.
> 
> I suggest CFP defer discussion of Issue 1, and first clarify the broader issues.
> 
> - Jim Thomas
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20240206/cdde8623/attachment.htm>


More information about the Cfp-interest mailing list