[libc-commits] [libc] [libc][math] Adding LIBC_MATH_ASSUME_ROUND_NEAREST_ONLY option (PR #201154)

via libc-commits libc-commits at lists.llvm.org
Wed Jun 10 14:49:27 PDT 2026


=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,
=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,
=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,
=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=,
=?utf-8?q?Ho=C3=A0ng_Minh_Thi=C3=AAn?=
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/201154 at github.com>


================
@@ -246,6 +246,10 @@ round_using_specific_rounding_mode(T x, int rnd) {
 template <typename T>
 LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_floating_point_v<T>, T>
 round_using_current_rounding_mode(T x) {
+#ifdef LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
+  return round_using_specific_rounding_mode(x, FP_INT_TONEAREST);
+#endif // LIBC_MATH_HAS_ASSUME_ROUND_NEAREST_ONLY
----------------
lntue wrote:

put the remaining `switch` to the `#else` clause.

https://github.com/llvm/llvm-project/pull/201154


More information about the libc-commits mailing list