[Cfp-interest 1438] Re: Updated range error file

Jim Thomas jaswthomas at sbcglobal.net
Tue Nov 12 15:34:24 PST 2019



> On Oct 15, 2019, at 9:31 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> Attached is the updated range error file.
> Comments welcome.
> 
> 
> 
> ---
> 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:Fred Tydeman
> Submission Date: 2019-10-??
> Document: WG14 Nxxxx
> Reference Documents:
> 
> Summary
> 
> The standard has a few incorrect, missing, or ambiguous statements about range errors in some of the math functions.
> 
> Does "too large" mean close to +infinity or +/-infinity?
> 
> Does "too small" mean close to -infinity or +/-zero?
> 
> Some implementations incorrectly treat f(infinity) as a range error based upon the text: A range error occurs if [the magnitude of] x is too large. While this is covered by 7.12.1#5 about overflows, the CFP group believes it is better to be explicit in each math function where it matters.
> 
> Possible Technical Corrigendum:
> 
> The asin functions
> Add to 7.12.4.2#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.

Also for asinpi.
> The atan functions
> Add to 7.12.4.3#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.

Also for atanpi
> The atan2 functions
> Add to 7.12.4.4#2
> 
> A range error occurs if x is positive and y/x is too close to zero.
Clarify by saying “… if nonzero y/x is too close to zero”.

Also for atan2pi.
> The sin functions
> Add to 7.12.4.6#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The tan functions
> Add to 7.12.4.7#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The sinpi functions
> Add to 7.12.4.13#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The tanpi functions
> Add to 7.12.4.14#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The asinh functions
> Add to 7.12.5.2#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The atanh functions
> Add to 7.12.5.3#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The cosh functions
> Change 7.12.5.4#2 from
> 
> A range error occurs if the magnitude of x is too large.
> to
> 
> A range error occurs if the magnitude of finite x is too large.
> The sinh functions
> Change 7.12.5.5#2 from
> 
> A range error occurs if the magnitude of x is too large.
> to
> 
> A range error occurs if the magnitude of finite x is too large or if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The tanh functions
> Add to 7.12.5.6#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The exp functions
> Change 7.12.6.1#2 from
> 
> A range error occurs if the magnitude of x is too large.
> to
> 
> A range error occurs if the magnitude of finite x is too large.
Might suggest there is a magnitude threshold for range errors. But the thresholds for positive and negative x are different. More explicit would be “… If the magnitude of positive finite x is too large or if the magnitude of negative finite x is too large."
> The exp10m1 functions
> Change 7.12.6.3#2 from
> 
> A range error occurs if finite x is too large or if the magnitude of nonzero x is too small.
> to
> 
> A range error occurs if positive finite x is too large or if the magnitude of nonzero x is too smallclose to zero.
Might suggest there is a magnitude threshold for range errors nears zero. But the thresholds for positive and negative x are different. More explicit would be “… if positive finite x is too large, if positive nonzero x is too close to zero, or if negative nonzero x is too close to zero."
> The exp2 functions
> Change 7.12.6.4#2 from
> 
> A range error occurs if the magnitude of x is too large.
> to
> 
> A range error occurs if the magnitude of finite x is too large.
More explicit would be “… If the magnitude of positive finite x is too large or if the magnitude of negative finite x is too large."
> The exp2m1 functions
> Change 7.12.6.5#2 from
> 
> A range error occurs if the magnitude of x is too large or if the magnitude of nonzero x is too small.
> to
> 
> A range error occurs if the magnitude of positive finite x is too large or if the magnitude of nonzero x is toosmallclose to zero.
More explicit would be “… if positive finite x is too large, if positive nonzero x is too close to zero, or if negative nonzero x is too close to zero."
> The expm1 functions
> Change 7.12.6.6#2 from
> A range error occurs if positive x is too large.252)
> to
> 
> A range error occurs if positive finite x is too large or if x is too close to zero.252)
More explicit would be “… if positive finite x is too large, if positive nonzero x is too close to zero, or if negative nonzero x is too close to zero."
> The ldexp functions
> Change 7.12.6.9#2 from
> 
> A range error may occur.
> to
> 
> A range error may occur for finite x.
This isn’t the way “may” is normally used in C. Better might be "A range error occurs for some finite x.”

We generally try to be more specific about when range errors occur, which is tricky for this and some other functions. Whether a range error occurs also depends on p. Maybe “A range error occurs if the magnitude of finite (positive or negative) nonzero x is too large or too near zero, depending on p."
> The log1p and logp1 functions
> Add to 7.12.6.14#2
> 
> A range error occurs if x is too close to zero.
More explicit would be “… if positive nonzero x is too close to zero or if negative nonzero x is too close to zero."
> The log2p1 functions
> Add to 7.12.6.16#2
> 
> A range error occurs if x is too close to zero.
More explicit would be “… if positive nonzero x is too close to zero or if negative nonzero x is too close to zero."
> The scalbn and scalbln functions
> Change 7.12.6.19#2 from
> 
> A range error may occur.
> to
> 
> A range error may occur for finite x.
See ldexp above. Maybe “A range error occurs if the magnitude of finite (positive or negative) nonzero x is too large or too near zero, depending on n."
> The compoundn functions
> Change 7.12.7.2#2 from
> 
> A range error may occur if n is too large, depending on x.
> to
> 
> A range error may occur if the magnitude of n is too large, depending on finite x.
Maybe “A range error occurs if the magnitude of finite positve x is too large or if negative x is too near -1, each depending on n."
> The hypot functions
> Change 7.12.7.4#2 from
> 
> A range error may occur.
> to
> 
> A range error may occur for finite arguments.
Maybe “A range error occurs for some finite arguments”, to avoid “may”.
> The pow functions
> Change 7.12.7.5#2 from
> 
> A range error may occur.
> to
> 
> A range error may occur for finite x.
Maybe "A range error occurs if the magnitude of nonzero finite x is too large or too near zero, depending on y."
> The pown functions
> Change 7.12.7.6#2 from
> 
> A range error may occur.
> to
> 
> A range error may occur for finite x.
Maybe "A range error occurs if the magnitude of nonzero finite x is too large or too near zero, depending on n."
> The powr functions
> Change 7.12.7.7#2 from
> 
> A range error may occur.
> to
> 
> A range error may occur for finite x.
Maybe "A range error occurs if the magnitude of nonzero finite (positive) x is too large or too near zero, depending on y."
> The rootn functions
> Change 7.12.7.8#2 from
> 
> A range error may occur if n is -1.
> to
> 
> A range error may occur for finite x if n is -1.
Maybe "A range occurs if the magnitude of finite nonzero x is too large or too near zero and n is -1."
> The erf functions
> Add to 7.12.8.1#2
> 
> A range error occurs if x is too close to zero.
Clarify by saying “… if nonzero x is too close to zero”.
> The erfc functions
> Change 7.12.8.2#2
> 
> A range error occurs if positive x is too large.
> to:
> 
> A range error occurs if positive finite x is too large.
Maybe “… if the magnitude of positive finite x is too large."
> The lgamma functions
> Change 7.12.8.3#2
> 
> A range error occurs if positive x is too large.
> to:
> 
> A range error occurs if positive finite x is too large.
Maybe “… if the magnitude of positive finite x is too large."
> The tgamma functions
> Change 7.12.8.4#2
> 
> A range error occurs if the magnitude of x is too large and may occur if the magnitude of x is too small.
> to:
> 
> A range error occurs for some negative finite x or if the magnitude ofpositive finite x is too large; and may occur if the magnitude of x is too smallclose to zero.
> The fmod functions
> Add to 7.12.10.1#2
> 
> A range error may occur if both x and y are nonzero and either is too close to zero.
“A range error occurs if x is finite, both x and y are nonzero, and either is too close to zero."
> The remainder functions
> Add to 7.12.10.2#2
> 
> A range error may occur if both x and y are nonzero and either is too close to zero.
“A range error occurs if x is finite, both x and y are nonzero, and either is too close to zero."

> The fdim functions
> Change 7.12.12.1#2
> 
> A range error may occur.
> to:
> 
> A range error may occur for finite arguments.
Maybe "A range error occurs if the magnitude of positive x - y is too large or too small."
> The fma functions
> Change 7.12.13.1#2
> 
> A range error may occur.
> to:
> 
> A range error may occur for finite arguments.
Maybe “A range error occurs for some finite arguments.”

- 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/20191112/e46cb29a/attachment-0003.html 


More information about the Cfp-interest mailing list