[libc-commits] [clang] [libc] [llvm] [clang] Make __builtin_exp and __builtin_expf constexpr. (PR #199808)

Hubert Tong via libc-commits libc-commits at lists.llvm.org
Fri Jul 24 19:22:18 PDT 2026


hubert-reinterpretcast wrote:

> it is because of the current limitation I put on `APFloat::exp` since I don't want to mess with the host's floating point environment:
> https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/APFloat.cpp#L6140

Can you explain the risk of modifying the floating point environment in a scoped manner (e.g., with an RAII pattern)?

> We are working on adding static rounding mode math functions that are integer-only without touching the host's floating point environment in LLVM libc, and we will use those to support constant evaluation for other rounding modes. WDYT?

Perhaps switching to the integer-only implementation could instead be an NFC improvement in the future. If the user is going to experience the effects of the "current limitation", then my position is that we'll need diagnostic messages that clearly identify those cases.

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


More information about the libc-commits mailing list