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

via libc-commits libc-commits at lists.llvm.org
Wed Jun 3 15:50:32 PDT 2026


=?utf-8?q?Hoàng_Minh_Thiên?=,=?utf-8?q?Hoàng_Minh_Thiên?=,
=?utf-8?q?Hoàng_Minh_Thiên?=,=?utf-8?q?Hoàng_Minh_Thiên?=,
=?utf-8?q?Hoàng_Minh_Thiên?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/201154 at github.com>


================
@@ -93,6 +93,11 @@ LIBC_INLINE constexpr float16 exp10m1f16(float16 x) {
       if (x_bits.is_inf())
         return FPBits::inf().get_val();
 
+#ifdef LIBC_MATH_HAS_ALWAYS_ROUND_NEAREST
+      fputil::set_errno_if_required(ERANGE);
+      fputil::raise_except_if_required(FE_OVERFLOW);
----------------
DylanFleming-arm wrote:

I believe this should also raise `FE_INEXACT`? The `FE_TONEAREST` case below has `fputil::raise_except_if_required(FE_OVERFLOW | FE_INEXACT);`

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


More information about the libc-commits mailing list