[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:33 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>


================

----------------
DylanFleming-arm wrote:

I think this should also be ifdef'd out.
As an added precaution, it might be a good idea to add these ifdefs inside of the fputil helpers too, in case anyone forgets to add these guards in the future.

In FPutil/rounding_mode.h:
```
LIBC_INLINE LIBC_CONSTEXPR_DEFAULT bool fenv_is_round_up() {
#ifdef LIBC_MATH_HAS_ALWAYS_ROUND_NEAREST
  return false;
#else
// normal code
```
and the same for round_down, to_zero, to_nearest (but returning true) and quick_get_round (returning `FE_TONEAREST`)

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


More information about the libc-commits mailing list