[libc] [llvm] [libc][math] Refactor expf implementation to header-only in src/__support/math folder. (PR #143790)

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 21:39:31 PDT 2025


================
@@ -0,0 +1,23 @@
+//===-- Floating point math functions ---------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SHARED_MATH_H
+#define LLVM_LIBC_SHARED_MATH_H
+
+#include "libc_common.h"
+#include "src/__support/math/expf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::expf;
----------------
vonosmas wrote:

Yeah, another consideration is portability - in case we will only be using some math functions on selected platforms, we can postpone fixing their headers in a way that would compile everywhere (even though it's less important for math).

I'm ambivalent about providing a single header exposing all the functions - we can always add it later when needed.

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


More information about the llvm-commits mailing list