<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 4, 2020, at 6:26 AM, David Jones via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">The LLVM IR reference manual states, for fptosi:</div><div class=""><br class=""></div><div class="">"The ‘<code class="gmail-docutils gmail-literal gmail-notranslate"><span class="gmail-pre">fptosi</span></code>’ instruction converts its <a class="gmail-internal gmail-reference" href="http://llvm.org/docs/LangRef.html#t-floating"><span class="gmail-std gmail-std-ref">floating-point</span></a> operand into the nearest (rounding towards zero)
signed integer value."</div><div class=""><br class=""></div><div class="">I interpreted this to mean that it rounds:</div><div class=""><br class=""></div><div class="">The nearest integer to 0.3 is 0.</div><div class=""><br class=""></div><div class="">The nearest integer to 0.9 is 1.</div><div class=""><br class=""></div><div class="">The nearest integer to 0.5 is either 0 or 1. And this is where the "rounding towards zero" applies - the result is prescribed to be 0.</div><div class=""><br class=""></div><div class="">In actuality, the instruction truncates, returning 0 for all cases.</div><div class=""><br class=""></div><div class="">Should this be reworded, perhaps to use the word "truncate”?</div></div></div></blockquote><br class=""></div><div>“Rounding towards zero” is a term of art from IEEE 754.  See <a href="https://en.wikipedia.org/wiki/IEEE_754#Directed_roundings" class="">https://en.wikipedia.org/wiki/IEEE_754#Directed_roundings</a></div><div><br class=""></div><div>I agree that the documentation could be made more accessible by *also* using the colloquial term “truncation”, but round-towards-zero is the correct name for this behavior and should be retained.</div><div><br class=""></div><div>—Owen</div></body></html>