[libc] [llvm] [APFloat] Add exp function for APFloat::IEEESsingle using expf implementation from LLVM libc. (PR #143959)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 22:52:33 PDT 2025


================
@@ -109,6 +109,18 @@ static constexpr float expf(float x) {
   return static_cast<float>(exp_hi * exp_mid * exp_lo);
 }
 
+// Directional rounding version of expf.
+LIBC_INLINE static float expf(float x, int rounding_mode) {
+  int current_rounding_mode = fputil::get_round();
----------------
arsenm wrote:

I would still be more comfortable if you just add an exp implementation with a template argument for the rounding mode, and didn't use fenv access anywhere in the stack. This has just merely shuffled the problem into the libc code directly 

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


More information about the llvm-commits mailing list