[libc] [llvm] [APFloat] Add exp function for APFloat::IEEESsingle using expf implementation from LLVM libc. (PR #143959)
    Nikita Popov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jul 30 01:26:38 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();
----------------
nikic wrote:
I'm kind of surprised that setting the rounding mode for a foo() implementation results in a foo() result with the correct rounding mode. Are the transcendental functions in libc specifically implemented in a way that satisfies that property?
Can you point me to where libc is testing these functions in different rounding modes?
https://github.com/llvm/llvm-project/pull/143959
    
    
More information about the llvm-commits
mailing list