<!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 not underflow, here are
proposed wording changes to the C standard.</p>
<p>C2x changes:</p>
<ul>
<li>7.12.1 Treatment of error conditions
<p>Add to 7.12.1#6 after the first sentance.</p>
<blockquote>
<ins>If the result is exactly representable, it is
implementation defined if an underflow happens.
Footnote</ins><br>
<p><ins>Footnote: Alternate exception handling (not part of
Standard C) is one way that an exact subnormal result is an
underflow.</ins></p>
</blockquote>
</li>
<li>The fmod functions
<p>Add to 7.12.10.1#2</p>
<blockquote>
<ins>A range error may occur 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 may occur 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 may occur <ins>if positive finite x-y is too
close to zero</ins>. <ins>A range error occurs if positive
finite x-y is too large</ins>.
</blockquote>
</li>
</ul>
</body>
</html>