Displaying 2 results from an estimated 2 matches for "directed_roundings".
2020 Sep 04
2
Misleading documentation on FP to integer conversion instructions?
The LLVM IR reference manual states, for fptosi:
"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."
I interpreted this to mean that it rounds:
The nearest integer to 0.3 is 0.
The nearest integer to 0.9 is 1.
The nearest integer to 0.5 is either 0 or 1. And
2020 Sep 04
4
Misleading documentation on FP to integer conversion instructions?
...lt is prescribed to be 0.
>
> In actuality, the instruction truncates, returning 0 for all cases.
>
> Should this be reworded, perhaps to use the word "truncate”?
>
>
> “Rounding towards zero” is a term of art from IEEE 754. See
> https://en.wikipedia.org/wiki/IEEE_754#Directed_roundings
>
> 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.
>
> —Owen
> _______________________________________________
> LLVM Deve...