[Cfp-interest 1777] Re: Exact subnormal results

Mike Cowlishaw mfc at speleotrove.com
Wed Sep 23 02:08:22 PDT 2020


[Couldn't resist 'grabbing' e-mail 1776 ... :-)]
 
Mike



  _____  

From: Cfp-interest [mailto:cfp-interest-bounces at oakapple.net] On Behalf Of
Jim Thomas
Sent: 22 September 2020 23:43
To: Fred J. Tydeman
Cc: CFP
Subject: [Cfp-interest 1773] Re: Exact subnormal results





On Sep 1, 2020, at 12:09 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:

Attached is the rewrite on range errors and exact subnormal results.


---
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 <http://www.tybor.com/> 
Savers sleep well, investors eat well, spenders work forever.




Submitter:CFP group
Submission Date: 2020-??-??
Document: WG14 N25??
Title: N25??: Exact subnormal results
Reference Documents:N2506

Summary

This is a follow on to N2506 that was accepted (except for three math
functions). Those three functions [fmod(), remainder(), and remquo()] can
produce exact subnormal results and there was a question on should they
underflow.

7.12.1 Treatment of error conditions has two "requirements" related to this
issue.

#4 has:

Likewise, 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.

#6 has:

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

So, if an exact subnormal result is produced, is it an underflow range
error?

Since it is exact, it is representable, so does not meet the condition in
paragraph 4.

Since it is subnormal, it meets the condition of paragraph 6.

So what is it?

Assuming exact subnormal results are underflow, here are proposed wording
changes to the C standard.

Note: Since what happens on underflow is implementation defined, these
changes do not cause any existing implementation to change.

C2x changes:

*	7.12.1 Treatment of error conditions 


	Add to 7.12.1#4 after the first sentance.

	Also, a range error occurs if the mathematical result is beyond the
range where all values can be represented in an object of the specified
type, to the full precision of the type.footnote 

	footnote: Exact subnormal results are a range error.

Consider changing the footnote to "A range error occurs if the function
result is subnormal, even if the mathematical result is represented exactly
in the type."


- Jim Thomas

*	The fmod functions 


	Add to 7.12.10.1#2

	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 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 occuroccurs if positive finite x-y is either too
large or too close to zero.

	Change F.10.9.1 The fdim functions

	No aditional requirements.

	to:

	No aditional requirements. When subnormal results are supported, the
returned value is exact and is independent of the current rounding direction
mode.

_______________________________________________
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/20200923/6933bbcc/attachment-0001.htm>


More information about the Cfp-interest mailing list