[llvm-dev] Misleading documentation on FP to integer conversion instructions?
Adrian McCarthy via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 8 09:04:37 PDT 2020
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.
> The ‘fptosi’ instruction converts its floating-point
<http://llvm.org/docs/LangRef.html#t-floating> operand into the
nearest (rounding
towards zero) signed integer value.
The remaining sentence is not only different than what was intended, but it
is also false.
> The ‘fptosi’ instruction converts its floating-point
<http://llvm.org/docs/LangRef.html#t-floating> operand into the nearest
signed integer value whose absolute value is not larger than the
floating-point operand (i.e., it rounds towards zero).
By the way, parenthetical phrases aren't always inside parentheses.
Sometimes they are set off with commas or dashes instead.
On Fri, Sep 4, 2020 at 12:40 PM Steve (Numerics) Canon via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> On Sep 4, 2020, at 2:40 PM, Neil Nelson via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>
> If fptosi takes 0.9 -> 0, then that is not 'rounding' in any sense I'm
> aware of (IEEE754 or otherwise).
> Rounding (in the IEE754 sense) determines how a number is converted when
> it is halfway between two
> candidate results. (see round(), ceil(), floor()).
>
>
> 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:
>
> - round to nearest, ties to even (default rounding)
> - round to nearest, ties away from zero (only for decimal)
> - round to nearest, ties toward zero (used only for augmented addition)
> - round up
> - round down
> - round toward zero
>
> 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”).
>
> – Steve
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200908/bebcb001/attachment.html>
More information about the llvm-dev
mailing list