<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello neighbors,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You can argue that the documentation is confusing (because some were confused; ipso facto), but this appeal to grammar is wrong.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">A sentence cannot (grammatically) rely on the portion in parentheses. However, the portion in parentheses can (and typically does) alter the meaning of a sentence. Why would anyone go to all that trouble if it couldn’t?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Even if what the author (Adrian) said was true, the sentence is still acceptable (albeit potentially confusing).
<b>The result is the nearest signed integer value</b>. Oh (gasp!), but what does “nearest” mean in this sentence? We have yet to establish any sort of metric. Enter the parentheses, one of whose (common) uses is to provide
<i>clarification</i>. And thus, with a clarification (in parentheses), the sentence is complete, and read literally leaves no room for ambiguity (but how does one round? Oh, in the direction of zero. Got it). However, as it has confused at least one person
it is also accurate to label it <i>confusing</i>. <i>Misleading</i>? Well that implies intent, and is an unfortunate word choice.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This is perfectly cromulent use of the word “rounding. Rounding means replacing a <a href="https://en.wikipedia.org/wiki/Number" title="Number">number</a> with an <a href="https://en.wikipedia.org/wiki/Approximation" title="Approximation">approximate</a> value
that has a <a href="https://en.wikipedia.org/wiki/Concision" title="Concision">shorter</a>, <a href="https://en.wikipedia.org/wiki/Simplicity" title="Simplicity">simpler</a>, or more explicit representation (Wikipedia:
<a href="https://en.wikipedia.org/wiki/Rounding">Rounding</a>). It makes no assumption of what shorter, simpler, or more explicit means. One must clarify. The documentation does, in an unambiguous manner.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Your friend,<o:p></o:p></p>
<p class="MsoNormal">Jordan<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">llvm-dev <llvm-dev-bounces@lists.llvm.org> on behalf of Adrian McCarthy via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Reply-To: </b>Adrian McCarthy <amccarth@google.com><br>
<b>Date: </b>Tuesday, September 8, 2020 at 9:05 AM<br>
<b>To: </b>"Steve (Numerics) Canon" <scanon@apple.com><br>
<b>Cc: </b>llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Subject: </b>Re: [llvm-dev] Misleading documentation on FP to integer conversion instructions?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Regardless of whether "rounding towards zero" is a term of art, putting it in parentheses creates confusion. Parenthetical phrases should be used to provide additional but non-essential information to a sentence. If striking out a parenthetical
expression changes the meaning of the sentence, then it shouldn't have been parenthetical.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">> The ‘<code><span style="font-size:10.0pt">fptosi</span></code>’ instruction converts its <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_LangRef.html-23t-2Dfloating&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=E_cXPNvxfZblQcT36zywtDUO0KZpVd9qvHbRN7gfLOU&m=1L8phTIjRC_ce9r56UvwXomoUY2JQ9RNbzdm0jJUW2U&s=PKl7LvjMA5oLaeb-HzAPIWxBMguf3T00GXYALXdXmJo&e=" target="_blank">floating-point</a> operand
into the nearest <s>(rounding towards zero)</s> signed integer value.<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The remaining sentence is not only different than what was intended, but it is also false.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">> The ‘<code><span style="font-size:10.0pt">fptosi</span></code>’ instruction converts its <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_LangRef.html-23t-2Dfloating&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=E_cXPNvxfZblQcT36zywtDUO0KZpVd9qvHbRN7gfLOU&m=1L8phTIjRC_ce9r56UvwXomoUY2JQ9RNbzdm0jJUW2U&s=PKl7LvjMA5oLaeb-HzAPIWxBMguf3T00GXYALXdXmJo&e=" target="_blank">floating-point</a> operand
into the nearest signed integer value whose absolute value is not larger than the floating-point operand (i.e., it rounds towards zero).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">By the way, parenthetical phrases aren't always inside parentheses. Sometimes they are set off with commas or dashes instead.<o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, Sep 4, 2020 at 12:40 PM Steve (Numerics) Canon via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Sep 4, 2020, at 2:40 PM, Neil Nelson via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt;font-variant-caps:normal;text-align:start;word-spacing:0px">
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Helvetica">If fptosi takes 0.9 -> 0, then that is not 'rounding' in any sense I'm aware of (IEEE754 or otherwise). <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Helvetica">Rounding (in the IEE754 sense) determines how a number is converted when it is halfway between two<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Helvetica">candidate results. (see round(), ceil(), floor()).<o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Rounding in the IEEE 754 sense is simply an algorithm to choose one of the two closest values from some set. It does not only concern how halfway cases are handled. There are a number of rounding attributes defined by IEEE 754:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">- round to nearest, ties to even (default rounding)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- round to nearest, ties away from zero (only for decimal)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- round to nearest, ties toward zero (used only for augmented addition)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- round up<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- round down<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- round toward zero<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The last of these is the rounding mode under discussion on this thread. Note that the first three have to specify how halfway cases are handled (“ties to …”), but the latter three do not (because the result is constant across the interval
between any two values, so there is not change at “halfway”).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">– Steve<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=E_cXPNvxfZblQcT36zywtDUO0KZpVd9qvHbRN7gfLOU&m=1L8phTIjRC_ce9r56UvwXomoUY2JQ9RNbzdm0jJUW2U&s=wAB-SJpJVLEdvO0EQhi0nzvhRAe_r9UnAdrXuI3gIKw&e=" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>