Skip to content

Commit fb14662

Browse files
authored
LangRef: rint, nearbyint: mention that default rounding mode is assumed (#77191)
LLVM assumes round-to-nearest mode and sometimes performs constant-folding based on that assumption. This updates the language ref documentation for the rint and nearbyint intrinsics to mention that fact.
1 parent 47605ff commit fb14662

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

llvm/docs/LangRef.rst

+10-2
Original file line numberDiff line numberDiff line change
@@ -15754,7 +15754,11 @@ Semantics:
1575415754
""""""""""
1575515755

1575615756
This function returns the same values as the libm ``rint`` functions
15757-
would, and handles error conditions in the same way.
15757+
would, and handles error conditions in the same way. Since LLVM assumes the
15758+
:ref:`default floating-point environment <floatenv>`, the rounding mode is
15759+
assumed to be set to "nearest", so halfway cases are rounded to the even
15760+
integer. Use :ref:`Constrained Floating-Point Intrinsics <constrainedfp>`
15761+
to avoid that assumption.
1575815762

1575915763
.. _int_nearbyint:
1576015764

@@ -15792,7 +15796,11 @@ Semantics:
1579215796
""""""""""
1579315797

1579415798
This function returns the same values as the libm ``nearbyint``
15795-
functions would, and handles error conditions in the same way.
15799+
functions would, and handles error conditions in the same way. Since LLVM
15800+
assumes the :ref:`default floating-point environment <floatenv>`, the rounding
15801+
mode is assumed to be set to "nearest", so halfway cases are rounded to the even
15802+
integer. Use :ref:`Constrained Floating-Point Intrinsics <constrainedfp>` to
15803+
avoid that assumption.
1579615804

1579715805
.. _int_round:
1579815806

0 commit comments

Comments
 (0)