[llvm] fb14662 - LangRef: rint, nearbyint: mention that default rounding mode is assumed (#77191)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 12:41:29 PST 2024


Author: Ralf Jung
Date: 2024-01-09T12:41:24-08:00
New Revision: fb1466216889e9f4d884a387f430d2e85b4542f6

URL: https://github.com/llvm/llvm-project/commit/fb1466216889e9f4d884a387f430d2e85b4542f6
DIFF: https://github.com/llvm/llvm-project/commit/fb1466216889e9f4d884a387f430d2e85b4542f6.diff

LOG: 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.

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index c90b6becae5254..2722333c710c2c 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -15754,7 +15754,11 @@ Semantics:
 """"""""""
 
 This function returns the same values as the libm ``rint`` functions
-would, and handles error conditions in the same way.
+would, and handles error conditions in the same way. Since LLVM assumes the
+:ref:`default floating-point environment <floatenv>`, the rounding mode is
+assumed to be set to "nearest", so halfway cases are rounded to the even
+integer. Use :ref:`Constrained Floating-Point Intrinsics <constrainedfp>`
+to avoid that assumption.
 
 .. _int_nearbyint:
 
@@ -15792,7 +15796,11 @@ Semantics:
 """"""""""
 
 This function returns the same values as the libm ``nearbyint``
-functions would, and handles error conditions in the same way.
+functions would, and handles error conditions in the same way. Since LLVM
+assumes the :ref:`default floating-point environment <floatenv>`, the rounding
+mode is assumed to be set to "nearest", so halfway cases are rounded to the even
+integer. Use :ref:`Constrained Floating-Point Intrinsics <constrainedfp>` to
+avoid that assumption.
 
 .. _int_round:
 


        


More information about the llvm-commits mailing list