<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for OS/2 (vers 1 September 2005), see www.w3.org">
<style type="text/css">
del { font-weight:bold;background-color:#ffa0a0 }
ins { font-weight:bold;background-color:#a0ffa0 }
blockquote {
display: block;
font-family: "Times New Roman";
background-color:lightgray;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 40px;
margin-right: 40px
}
</style>
<title>N25??: Exact subnormal results</title>
</head>
<body>
<p><br>
<!-- Who are the authors... -->
<b>Submitter:</b>CFP group<br>
<!-- What is the date of submission. yyyy-mm-dd -->
<b>Submission Date:</b> 2020-??-??<br>
<b>Document:</b> WG14 N25??<br>
<b>Title:</b> N25??: Exact subnormal results<br>
<b>Reference Documents:</b>N2506</p>
<p>Summary</p>
<p>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.</p>
<p>7.12.1 Treatment of error conditions has two "requirements"
related to this issue.</p>
<p>#4 has:</p>
<blockquote>
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.
</blockquote>
<p>#6 has:</p>
<blockquote>
The result underflows if the magnitude of the mathematical
result is nonzero and less than the minimum normal number in
the type.243)
</blockquote>
<p>So, if an exact subnormal result is produced, is it an
underflow range error?</p>
<p>Since it is exact, it is representable, so does not meet the
condition in paragraph 4.</p>
<p>Since it is subnormal, it meets the condition of paragraph
6.</p>
<p>So what is it?</p>
<p>Assuming exact subnormal results are underflow, here are
proposed wording changes to the C standard.</p>
<p>Note: Since what happens on underflow is implementation
defined, these changes do not cause any existing implementation
to change.</p>
<p>C2x changes:</p>
<ul>
<li>7.12.1 Treatment of error conditions
<p>Add to 7.12.1#4 after the first sentance.</p>
<blockquote>
<ins>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</ins>
<p><ins>footnote: Exact subnormal results are a range
error.</ins></p>
</blockquote>
</li>
<li>The fmod functions
<p>Add to 7.12.10.1#2</p>
<blockquote>
<ins>A range error occurs if x is finite, both x and y are
nonzero, and either is too close to zero.</ins>
</blockquote>
</li>
<li>The remainder functions
<p>Add to 7.12.10.2#2</p>
<blockquote>
<ins>A range error occurs if x is finite, both x and y are
nonzero, and either is too close to zero.</ins>
</blockquote>
</li>
<li>The fdim functions
<p>Change 7.12.12.1#2</p>
<blockquote>
A range error may occur.
</blockquote>
<p>to:</p>
<blockquote>
A range error <del>may occur</del><ins>occurs if positive
finite x-y is either too large or too close to zero</ins>.
</blockquote>
<p>Change F.10.9.1 The fdim functions</p>
<blockquote>
No aditional requirements.
</blockquote>
<p>to:</p>
<blockquote>
<del>No aditional requirements.</del> <ins>When subnormal
results are supported, the returned value is exact and is
independent of the current rounding direction mode.</ins>
</blockquote>
</li>
</ul>
</body>
</html>