[libc-commits] [libc] [llvm] [libc][math] Refactor log10, log1p, log2 implementation to header-only in src/__support/math folder. (PR #176089)
Muhammad Bassiouni via libc-commits
libc-commits at lists.llvm.org
Thu Jan 15 22:58:19 PST 2026
================
@@ -0,0 +1,917 @@
+//===-- Double-precision log10(x) function --------------------------------===//
+//
+// 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_SRC___SUPPORT_MATH_LOG10_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_LOG10_H
+
+#include "common_constants.h"
+#include "log_range_reduction.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/PolyEval.h"
+#include "src/__support/FPUtil/double_double.h"
+#include "src/__support/FPUtil/dyadic_float.h"
+#include "src/__support/FPUtil/multiply_add.h"
+#include "src/__support/common.h"
+#include "src/__support/integer_literals.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+namespace log10_internal {
+// 128-bit precision dyadic floating point numbers.
+using Float128 = typename fputil::DyadicFloat<128>;
+
+using LIBC_NAMESPACE::operator""_u128;
+
+using namespace common_constants_internal;
+using namespace math::log_range_reduction_internal;
+
+constexpr fputil::DoubleDouble LOG10_E = {0x1.95355baaafad3p-57,
----------------
bassiounix wrote:
```suggestion
LIBC_INLINE_VAR constexpr fputil::DoubleDouble LOG10_E = {0x1.95355baaafad3p-57,
```
https://github.com/llvm/llvm-project/pull/176089
More information about the libc-commits
mailing list