From 02517287a314c9396a6f04ff2f72f5e508e93413 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 6 Jan 2024 13:06:04 +0100 Subject: [PATCH] LangRef: rint, nearbyint: mention that default rounding mode is assumed --- llvm/docs/LangRef.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index b5918e3063d86..02d4dce557a3d 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -15751,7 +15751,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 `, 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 ` +to avoid that assumption. .. _int_nearbyint: @@ -15789,7 +15793,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 `, 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 ` to +avoid that assumption. .. _int_round: