[Cfp-interest 1397] Re: Math functions & range errors

Jim Thomas jaswthomas at sbcglobal.net
Tue Aug 27 10:47:43 PDT 2019


C has a general definition of range errors much like you suggest:

> a range error occurs if and only if the mathematical result of the function cannot be
> represented in an object of the specified type, due to extreme magnitude.

Then it says

> The description of each
> function lists any required range errors; an implementation may define additional range errors,
> provided that such errors are consistent with the mathematical definition of the function and are the
> result of either overflow or underflow.

> A floating result overflows if the magnitude of the mathematical result is finite but so large that
> the mathematical result cannot be represented without extraordinary roundoff error in an object
> of the specified type. …

> The result underflows if the magnitude of the mathematical result is nonzero and less than the
> minimum normal number in the type. ...

The problems Fred’s paper is addressing are in the lists of the required range errors for the particular functions, which reference the arguments. These lists attempt to describe where the range errors occur, or at least where they must or might be reported. This goes back to before any IEC 60559 support. 

- Jim Thomas

> On Aug 27, 2019, at 10:17 AM, David Hough CFP <pcfp at oakapple.net> wrote:
> 
> I think the discussion of tgamma makes the point that range errors are about 
> the result, not the argument.    For monotonic functions, that can be mapped
> back into statements about the argument.    What about functions of two
> arguments?
> 
> For consistency, one might want to say something  like a range
> error occurs 
> when the magnitude of the correct result lies outside the range of normalized
> numbers.    Or maybe "sufficiently outside" instead of "outside" to allow
> for results that happen to round back in to the normalized range.
> 
> But then what about subnormal numbers?    In 754, exact subnormal results
> are exceptional - but you only notice if alternate exception handling is
> enabled.     Does C consistently classify exact subnormal results as range
> errors or not?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20190827/503bfc8c/attachment-0001.html 


More information about the Cfp-interest mailing list