[libc-commits] [libc] [llvm] [libc][math] Refactor llogbl to be header-only and constexpr (PR #175376)
Mathew Joseph via libc-commits
libc-commits at lists.llvm.org
Mon Feb 9 05:46:29 PST 2026
https://github.com/mathew1046 updated https://github.com/llvm/llvm-project/pull/175376
>From 3e1df8bdf697cbd06d5173875dbb9db9646ea3ed Mon Sep 17 00:00:00 2001
From: Mathew Joseph <mathewjosephparakka at gmail.com>
Date: Sun, 11 Jan 2026 00:22:20 +0530
Subject: [PATCH 01/14] [libc] Refactor llogbl to be header-only and constexpr
Refactor the llogbl (log base 2 of absolute value for long double) function
to be header-only and marked constexpr, enabling compile-time evaluation and
inlining opportunities while maintaining binary compatibility.
Changes:
1. Move the implementation into libc/src/math/llogbl.h as an inline constexpr
function that delegates to the existing fputil::intlogb<long> template
(which is already constexpr-compatible).
2. Simplify libc/src/math/generic/llogbl.cpp to be a thin wrapper that exports
the public C symbol via LLVM_LIBC_FUNCTION, ensuring binary compatibility
with shipped libc libraries.
3. Add constexpr compile-time tests (static_assert) in the test file to verify
that llogbl can be evaluated at compile time for normal numbers with various
exponents (powers of 2 from 2^-1 to 2^10).
4. The underlying fputil::intlogb<long> already handles constexpr evaluation
correctly for all cases (zero, NaN, infinity, subnormals) by using
is_constant_evaluated() to skip errno/FE flag operations at compile time.
Benefits:
- Callers can now use constexpr long result = llogbl(2.0L); at compile time
- Compiler can inline the function for better optimization
- No ABI changes; binary compatibility is maintained
- No platform-specific issues; inherits robust handling from fputil
Fixes: https://github.com/llvm/llvm-project/issues/175361
Signed-off-by: Mathew Joseph <mathewjosephparakka at gmail.com>
---
libc/src/math/generic/llogbl.cpp | 9 +++----
libc/src/math/llogbl.h | 7 ++++-
libc/test/src/math/smoke/llogbl_test.cpp | 34 ++++++++++++++++++++++++
3 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/libc/src/math/generic/llogbl.cpp b/libc/src/math/generic/llogbl.cpp
index 7ee3ac55653b6..73a104de57357 100644
--- a/libc/src/math/generic/llogbl.cpp
+++ b/libc/src/math/generic/llogbl.cpp
@@ -7,14 +7,13 @@
//===----------------------------------------------------------------------===//
#include "src/math/llogbl.h"
-#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
-#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
-LLVM_LIBC_FUNCTION(long, llogbl, (long double x)) {
- return fputil::intlogb<long>(x);
-}
+// Export the public C symbol by wrapping the inline constexpr definition.
+// This maintains binary compatibility with the shipped libc while allowing
+// callers to evaluate llogbl at compile time or have it inlined.
+LLVM_LIBC_FUNCTION(long, llogbl, (long double x)) { return llogbl(x); }
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/llogbl.h b/libc/src/math/llogbl.h
index bf502a1c0bc3b..4a45eb6f1d895 100644
--- a/libc/src/math/llogbl.h
+++ b/libc/src/math/llogbl.h
@@ -9,12 +9,17 @@
#ifndef LLVM_LIBC_SRC_MATH_LLOGBL_H
#define LLVM_LIBC_SRC_MATH_LLOGBL_H
+#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
-long llogbl(long double x);
+// Inline constexpr implementation: extract the unbiased exponent of a long double
+// by delegating to the existing constexpr template fputil::intlogb<long>.
+LIBC_INLINE constexpr long llogbl(long double x) {
+ return fputil::intlogb<long>(x);
+}
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/src/math/smoke/llogbl_test.cpp b/libc/test/src/math/smoke/llogbl_test.cpp
index c698210fc3de1..20332bfd6776b 100644
--- a/libc/test/src/math/smoke/llogbl_test.cpp
+++ b/libc/test/src/math/smoke/llogbl_test.cpp
@@ -11,3 +11,37 @@
#include "src/math/llogbl.h"
LIST_INTLOGB_TESTS(long, long double, LIBC_NAMESPACE::llogbl);
+
+// Constexpr tests: verify that llogbl can be evaluated at compile time.
+// These static_assert cases cover normal numbers with various exponents.
+namespace {
+class LLogblConstexprTest : public LIBC_NAMESPACE::testing::Test {
+public:
+ void RunTests() {
+ // Normal numbers: 2^0 = 1.0 => exponent 0
+ static_assert(LIBC_NAMESPACE::llogbl(1.0L) == 0);
+ static_assert(LIBC_NAMESPACE::llogbl(-1.0L) == 0);
+
+ // Normal numbers: 2^1 = 2.0 => exponent 1
+ static_assert(LIBC_NAMESPACE::llogbl(2.0L) == 1);
+ static_assert(LIBC_NAMESPACE::llogbl(-2.0L) == 1);
+
+ // Normal numbers: 2^2 = 4.0 => exponent 2
+ static_assert(LIBC_NAMESPACE::llogbl(4.0L) == 2);
+ static_assert(LIBC_NAMESPACE::llogbl(-4.0L) == 2);
+
+ // Normal numbers: 2^(-1) = 0.5 => exponent -1
+ static_assert(LIBC_NAMESPACE::llogbl(0.5L) == -1);
+ static_assert(LIBC_NAMESPACE::llogbl(-0.5L) == -1);
+
+ // Normal numbers: 2^3 = 8.0 => exponent 3
+ static_assert(LIBC_NAMESPACE::llogbl(8.0L) == 3);
+
+ // Normal numbers: 2^10 = 1024.0 => exponent 10
+ static_assert(LIBC_NAMESPACE::llogbl(1024.0L) == 10);
+ }
+};
+
+// Instantiate the test to trigger static_asserts at compile time.
+LLogblConstexprTest constexpr_test;
+} // anonymous namespace
>From 7a4b39ed071e8e0e0169917971fb9c2e53e2cf65 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <69132893+mathew1046 at users.noreply.github.com>
Date: Sun, 11 Jan 2026 00:45:07 +0530
Subject: [PATCH 02/14] Update libc/test/src/math/smoke/llogbl_test.cpp
Co-authored-by: Copilot <175728472+Copilot at users.noreply.github.com>
---
libc/test/src/math/smoke/llogbl_test.cpp | 51 ++++++++++--------------
1 file changed, 22 insertions(+), 29 deletions(-)
diff --git a/libc/test/src/math/smoke/llogbl_test.cpp b/libc/test/src/math/smoke/llogbl_test.cpp
index 20332bfd6776b..5558960beabd1 100644
--- a/libc/test/src/math/smoke/llogbl_test.cpp
+++ b/libc/test/src/math/smoke/llogbl_test.cpp
@@ -15,33 +15,26 @@ LIST_INTLOGB_TESTS(long, long double, LIBC_NAMESPACE::llogbl);
// Constexpr tests: verify that llogbl can be evaluated at compile time.
// These static_assert cases cover normal numbers with various exponents.
namespace {
-class LLogblConstexprTest : public LIBC_NAMESPACE::testing::Test {
-public:
- void RunTests() {
- // Normal numbers: 2^0 = 1.0 => exponent 0
- static_assert(LIBC_NAMESPACE::llogbl(1.0L) == 0);
- static_assert(LIBC_NAMESPACE::llogbl(-1.0L) == 0);
-
- // Normal numbers: 2^1 = 2.0 => exponent 1
- static_assert(LIBC_NAMESPACE::llogbl(2.0L) == 1);
- static_assert(LIBC_NAMESPACE::llogbl(-2.0L) == 1);
-
- // Normal numbers: 2^2 = 4.0 => exponent 2
- static_assert(LIBC_NAMESPACE::llogbl(4.0L) == 2);
- static_assert(LIBC_NAMESPACE::llogbl(-4.0L) == 2);
-
- // Normal numbers: 2^(-1) = 0.5 => exponent -1
- static_assert(LIBC_NAMESPACE::llogbl(0.5L) == -1);
- static_assert(LIBC_NAMESPACE::llogbl(-0.5L) == -1);
-
- // Normal numbers: 2^3 = 8.0 => exponent 3
- static_assert(LIBC_NAMESPACE::llogbl(8.0L) == 3);
-
- // Normal numbers: 2^10 = 1024.0 => exponent 10
- static_assert(LIBC_NAMESPACE::llogbl(1024.0L) == 10);
- }
-};
-
-// Instantiate the test to trigger static_asserts at compile time.
-LLogblConstexprTest constexpr_test;
+
+// Normal numbers: 2^0 = 1.0 => exponent 0
+static_assert(LIBC_NAMESPACE::llogbl(1.0L) == 0);
+static_assert(LIBC_NAMESPACE::llogbl(-1.0L) == 0);
+
+// Normal numbers: 2^1 = 2.0 => exponent 1
+static_assert(LIBC_NAMESPACE::llogbl(2.0L) == 1);
+static_assert(LIBC_NAMESPACE::llogbl(-2.0L) == 1);
+
+// Normal numbers: 2^2 = 4.0 => exponent 2
+static_assert(LIBC_NAMESPACE::llogbl(4.0L) == 2);
+static_assert(LIBC_NAMESPACE::llogbl(-4.0L) == 2);
+
+// Normal numbers: 2^(-1) = 0.5 => exponent -1
+static_assert(LIBC_NAMESPACE::llogbl(0.5L) == -1);
+static_assert(LIBC_NAMESPACE::llogbl(-0.5L) == -1);
+
+// Normal numbers: 2^3 = 8.0 => exponent 3
+static_assert(LIBC_NAMESPACE::llogbl(8.0L) == 3);
+
+// Normal numbers: 2^10 = 1024.0 => exponent 10
+static_assert(LIBC_NAMESPACE::llogbl(1024.0L) == 10);
} // anonymous namespace
>From 817a118b3aefacf56afd9e19f01d30bef0ae1cd8 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <69132893+mathew1046 at users.noreply.github.com>
Date: Sun, 11 Jan 2026 00:45:22 +0530
Subject: [PATCH 03/14] Update libc/src/math/generic/llogbl.cpp
Co-authored-by: Copilot <175728472+Copilot at users.noreply.github.com>
---
libc/src/math/generic/llogbl.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libc/src/math/generic/llogbl.cpp b/libc/src/math/generic/llogbl.cpp
index 73a104de57357..6fa675f566755 100644
--- a/libc/src/math/generic/llogbl.cpp
+++ b/libc/src/math/generic/llogbl.cpp
@@ -14,6 +14,8 @@ namespace LIBC_NAMESPACE_DECL {
// Export the public C symbol by wrapping the inline constexpr definition.
// This maintains binary compatibility with the shipped libc while allowing
// callers to evaluate llogbl at compile time or have it inlined.
-LLVM_LIBC_FUNCTION(long, llogbl, (long double x)) { return llogbl(x); }
+LLVM_LIBC_FUNCTION(long, llogbl, (long double x)) {
+ return LIBC_NAMESPACE::llogbl(x);
+}
} // namespace LIBC_NAMESPACE_DECL
>From c089a091bc6ff1cae1918643d2b38635ec0c32e0 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <mathewjosephparakka at gmail.com>
Date: Fri, 16 Jan 2026 16:53:03 +0530
Subject: [PATCH 04/14] fix: [libc][math] Refactor llogbl implementation to
header-only in src/__support/math folder
---
libc/shared/math.h | 4 +++
libc/shared/math/llogbl.h | 23 ++++++++++++++++
libc/src/__support/math/CMakeLists.txt | 8 ++++++
libc/src/__support/math/llogbl.h | 27 +++++++++++++++++++
libc/src/math/generic/CMakeLists.txt | 2 +-
libc/src/math/generic/llogbl.cpp | 8 ++----
libc/src/math/llogbl.h | 8 +-----
libc/test/shared/CMakeLists.txt | 4 +++
libc/test/shared/shared_math_test.cpp | 4 +++
libc/test/src/math/smoke/llogbl_test.cpp | 21 ++++++++-------
.../llvm-project-overlay/libc/BUILD.bazel | 15 ++++++++++-
11 files changed, 99 insertions(+), 25 deletions(-)
create mode 100644 libc/shared/math/llogbl.h
create mode 100644 libc/src/__support/math/llogbl.h
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 110b4bfe81073..31ff3da7c8496 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -80,6 +80,7 @@
#include "math/ldexpf.h"
#include "math/ldexpf128.h"
#include "math/ldexpf16.h"
+<<<<<<< HEAD
#include "math/llogb.h"
#include "math/llogbf.h"
#include "math/llogbf128.h"
@@ -93,6 +94,9 @@
#include "math/logbf16.h"
#include "math/logf.h"
#include "math/logf16.h"
+=======
+#include "math/llogbl.h"
+>>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
#include "math/rsqrtf.h"
#include "math/rsqrtf16.h"
#include "math/sin.h"
diff --git a/libc/shared/math/llogbl.h b/libc/shared/math/llogbl.h
new file mode 100644
index 0000000000000..3135787e08d2f
--- /dev/null
+++ b/libc/shared/math/llogbl.h
@@ -0,0 +1,23 @@
+//===-- Shared llogbl function ----------------------------------*- 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_LLOGBL_H
+#define LLVM_LIBC_SHARED_MATH_LLOGBL_H
+
+#include "shared/libc_common.h"
+#include "src/__support/math/llogbl.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::llogbl;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SHARED_MATH_LLOGBL_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 3d43eccfdbe2c..8752a30178bea 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -797,6 +797,7 @@ add_header_library(
)
add_header_library(
+<<<<<<< HEAD
llogbf
HDRS
llogbf.h
@@ -825,6 +826,13 @@ add_header_library(
libc.src.__support.macros.optimization
libc.src.__support.macros.properties.cpu_features
libc.include.llvm-libc-macros.float16_macros
+=======
+ llogbl
+ HDRS
+ llogbl.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+>>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
)
add_header_library(
diff --git a/libc/src/__support/math/llogbl.h b/libc/src/__support/math/llogbl.h
new file mode 100644
index 0000000000000..03230f14313a4
--- /dev/null
+++ b/libc/src/__support/math/llogbl.h
@@ -0,0 +1,27 @@
+//===-- Implementation header for llogbl ------------------------*- 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_SRC___SUPPORT_MATH_LLOGBL_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_LLOGBL_H
+
+#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace math {
+
+LIBC_INLINE static constexpr long llogbl(long double x) {
+ return fputil::intlogb<long>(x);
+}
+
+} // namespace math
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_LLOGBL_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index be3f724e10a8b..2eb37b4ae9d8e 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -1798,7 +1798,7 @@ add_entrypoint_object(
HDRS
../llogbl.h
DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.math.llogbl
)
add_entrypoint_object(
diff --git a/libc/src/math/generic/llogbl.cpp b/libc/src/math/generic/llogbl.cpp
index 6fa675f566755..2cf1851f77945 100644
--- a/libc/src/math/generic/llogbl.cpp
+++ b/libc/src/math/generic/llogbl.cpp
@@ -8,14 +8,10 @@
#include "src/math/llogbl.h"
#include "src/__support/common.h"
+#include "src/__support/math/llogbl.h"
namespace LIBC_NAMESPACE_DECL {
-// Export the public C symbol by wrapping the inline constexpr definition.
-// This maintains binary compatibility with the shipped libc while allowing
-// callers to evaluate llogbl at compile time or have it inlined.
-LLVM_LIBC_FUNCTION(long, llogbl, (long double x)) {
- return LIBC_NAMESPACE::llogbl(x);
-}
+LLVM_LIBC_FUNCTION(long, llogbl, (long double x)) { return math::llogbl(x); }
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/llogbl.h b/libc/src/math/llogbl.h
index 4a45eb6f1d895..028bf1958c4ff 100644
--- a/libc/src/math/llogbl.h
+++ b/libc/src/math/llogbl.h
@@ -9,17 +9,11 @@
#ifndef LLVM_LIBC_SRC_MATH_LLOGBL_H
#define LLVM_LIBC_SRC_MATH_LLOGBL_H
-#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/macros/config.h"
-#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
-// Inline constexpr implementation: extract the unbiased exponent of a long double
-// by delegating to the existing constexpr template fputil::intlogb<long>.
-LIBC_INLINE constexpr long llogbl(long double x) {
- return fputil::intlogb<long>(x);
-}
+long llogbl(long double x);
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 7143ce6e84458..a0cb3dba2b652 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -86,10 +86,14 @@ add_fp_unittest(
libc.src.__support.math.ldexpf
libc.src.__support.math.ldexpf128
libc.src.__support.math.ldexpf16
+<<<<<<< HEAD
libc.src.__support.math.llogbf
libc.src.__support.math.llogbf128
libc.src.__support.math.llogbf16
libc.src.__support.math.logf16
+=======
+ libc.src.__support.math.llogbl
+>>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
libc.src.__support.math.rsqrtf
libc.src.__support.math.rsqrtf16
libc.src.__support.math.sqrtf16
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 73d6d836227b3..a6dd2af85289a 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -132,11 +132,15 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
EXPECT_FP_EQ(0x1p+0, LIBC_NAMESPACE::shared::exp2(0.0));
EXPECT_FP_EQ(0x1p+0, LIBC_NAMESPACE::shared::exp10(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::expm1(0.0));
+<<<<<<< HEAD
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::fsqrt(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log(1.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log10(1.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log1p(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log2(1.0));
+=======
+ EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
+>>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::sin(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::sqrt(0.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::tan(0.0));
diff --git a/libc/test/src/math/smoke/llogbl_test.cpp b/libc/test/src/math/smoke/llogbl_test.cpp
index 5558960beabd1..bbcda099e12c0 100644
--- a/libc/test/src/math/smoke/llogbl_test.cpp
+++ b/libc/test/src/math/smoke/llogbl_test.cpp
@@ -9,6 +9,7 @@
#include "ILogbTest.h"
#include "src/math/llogbl.h"
+#include "src/__support/math/llogbl.h"
LIST_INTLOGB_TESTS(long, long double, LIBC_NAMESPACE::llogbl);
@@ -17,24 +18,24 @@ LIST_INTLOGB_TESTS(long, long double, LIBC_NAMESPACE::llogbl);
namespace {
// Normal numbers: 2^0 = 1.0 => exponent 0
-static_assert(LIBC_NAMESPACE::llogbl(1.0L) == 0);
-static_assert(LIBC_NAMESPACE::llogbl(-1.0L) == 0);
+static_assert(LIBC_NAMESPACE::math::llogbl(1.0L) == 0);
+static_assert(LIBC_NAMESPACE::math::llogbl(-1.0L) == 0);
// Normal numbers: 2^1 = 2.0 => exponent 1
-static_assert(LIBC_NAMESPACE::llogbl(2.0L) == 1);
-static_assert(LIBC_NAMESPACE::llogbl(-2.0L) == 1);
+static_assert(LIBC_NAMESPACE::math::llogbl(2.0L) == 1);
+static_assert(LIBC_NAMESPACE::math::llogbl(-2.0L) == 1);
// Normal numbers: 2^2 = 4.0 => exponent 2
-static_assert(LIBC_NAMESPACE::llogbl(4.0L) == 2);
-static_assert(LIBC_NAMESPACE::llogbl(-4.0L) == 2);
+static_assert(LIBC_NAMESPACE::math::llogbl(4.0L) == 2);
+static_assert(LIBC_NAMESPACE::math::llogbl(-4.0L) == 2);
// Normal numbers: 2^(-1) = 0.5 => exponent -1
-static_assert(LIBC_NAMESPACE::llogbl(0.5L) == -1);
-static_assert(LIBC_NAMESPACE::llogbl(-0.5L) == -1);
+static_assert(LIBC_NAMESPACE::math::llogbl(0.5L) == -1);
+static_assert(LIBC_NAMESPACE::math::llogbl(-0.5L) == -1);
// Normal numbers: 2^3 = 8.0 => exponent 3
-static_assert(LIBC_NAMESPACE::llogbl(8.0L) == 3);
+static_assert(LIBC_NAMESPACE::math::llogbl(8.0L) == 3);
// Normal numbers: 2^10 = 1024.0 => exponent 10
-static_assert(LIBC_NAMESPACE::llogbl(1024.0L) == 10);
+static_assert(LIBC_NAMESPACE::math::llogbl(1024.0L) == 10);
} // anonymous namespace
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index b91a13b29d3c6..0e98e02bb6724 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3233,6 +3233,14 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_llogbl",
+ hdrs = ["src/__support/math/llogbl.h"],
+ deps = [
+ ":__support_fputil_manipulation_functions",
+ ],
+)
+
libc_support_library(
name = "__support_math_exp_constants",
hdrs = ["src/__support/math/exp_constants.h"],
@@ -4935,7 +4943,12 @@ libc_math_function(
additional_deps = [":__support_math_llogbf"],
)
-libc_math_function(name = "llogbl")
+libc_math_function(
+ name = "llogbl",
+ additional_deps = [
+ ":__support_math_llogbl",
+ ],
+)
libc_math_function(
name = "llogbf128",
>From 8d69d9447c0247e40c746b50bc6dc59ba52bc317 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <69132893+mathew1046 at users.noreply.github.com>
Date: Mon, 19 Jan 2026 21:41:58 +0530
Subject: [PATCH 05/14] Delete libc/test/src/math/smoke/llogbl_test.cpp
---
libc/test/src/math/smoke/llogbl_test.cpp | 41 ------------------------
1 file changed, 41 deletions(-)
delete mode 100644 libc/test/src/math/smoke/llogbl_test.cpp
diff --git a/libc/test/src/math/smoke/llogbl_test.cpp b/libc/test/src/math/smoke/llogbl_test.cpp
deleted file mode 100644
index bbcda099e12c0..0000000000000
--- a/libc/test/src/math/smoke/llogbl_test.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//===-- Unittests for llogbl ----------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "ILogbTest.h"
-
-#include "src/math/llogbl.h"
-#include "src/__support/math/llogbl.h"
-
-LIST_INTLOGB_TESTS(long, long double, LIBC_NAMESPACE::llogbl);
-
-// Constexpr tests: verify that llogbl can be evaluated at compile time.
-// These static_assert cases cover normal numbers with various exponents.
-namespace {
-
-// Normal numbers: 2^0 = 1.0 => exponent 0
-static_assert(LIBC_NAMESPACE::math::llogbl(1.0L) == 0);
-static_assert(LIBC_NAMESPACE::math::llogbl(-1.0L) == 0);
-
-// Normal numbers: 2^1 = 2.0 => exponent 1
-static_assert(LIBC_NAMESPACE::math::llogbl(2.0L) == 1);
-static_assert(LIBC_NAMESPACE::math::llogbl(-2.0L) == 1);
-
-// Normal numbers: 2^2 = 4.0 => exponent 2
-static_assert(LIBC_NAMESPACE::math::llogbl(4.0L) == 2);
-static_assert(LIBC_NAMESPACE::math::llogbl(-4.0L) == 2);
-
-// Normal numbers: 2^(-1) = 0.5 => exponent -1
-static_assert(LIBC_NAMESPACE::math::llogbl(0.5L) == -1);
-static_assert(LIBC_NAMESPACE::math::llogbl(-0.5L) == -1);
-
-// Normal numbers: 2^3 = 8.0 => exponent 3
-static_assert(LIBC_NAMESPACE::math::llogbl(8.0L) == 3);
-
-// Normal numbers: 2^10 = 1024.0 => exponent 10
-static_assert(LIBC_NAMESPACE::math::llogbl(1024.0L) == 10);
-} // anonymous namespace
>From 1cd9ed1273627e4c7c371f55633a563d7f0bb115 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <69132893+mathew1046 at users.noreply.github.com>
Date: Mon, 19 Jan 2026 21:42:56 +0530
Subject: [PATCH 06/14] Add include for types in llogbl.h
---
libc/src/math/llogbl.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/src/math/llogbl.h b/libc/src/math/llogbl.h
index 028bf1958c4ff..bf502a1c0bc3b 100644
--- a/libc/src/math/llogbl.h
+++ b/libc/src/math/llogbl.h
@@ -10,6 +10,7 @@
#define LLVM_LIBC_SRC_MATH_LLOGBL_H
#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
namespace LIBC_NAMESPACE_DECL {
>From a87022a83e92a84b04123faff1ec301ce1993988 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <mathewjosephparakka at gmail.com>
Date: Mon, 19 Jan 2026 22:04:50 +0530
Subject: [PATCH 07/14] Fix: Added test to the designated section for long
double
---
libc/test/shared/shared_math_test.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index a6dd2af85289a..b27ef113717f0 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -139,7 +139,6 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log1p(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log2(1.0));
=======
- EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
>>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::sin(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::sqrt(0.0));
@@ -180,3 +179,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
}
#endif // LIBC_TYPES_HAS_FLOAT128
+
+TEST(LlvmLibcSharedMathTest, AllLongDouble) {
+ EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
+}
>From edfa108a8d597fca5eea90de7715f243e4f3588d Mon Sep 17 00:00:00 2001
From: Mathew Joseph <69132893+mathew1046 at users.noreply.github.com>
Date: Tue, 27 Jan 2026 01:16:25 +0530
Subject: [PATCH 08/14] Remove constexpr tests from llogbl_test.cpp
Removed constexpr tests for llogbl function.
---
libc/test/src/math/smoke/llogbl_test.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 libc/test/src/math/smoke/llogbl_test.cpp
diff --git a/libc/test/src/math/smoke/llogbl_test.cpp b/libc/test/src/math/smoke/llogbl_test.cpp
new file mode 100644
index 0000000000000..c698210fc3de1
--- /dev/null
+++ b/libc/test/src/math/smoke/llogbl_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for llogbl ----------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "ILogbTest.h"
+
+#include "src/math/llogbl.h"
+
+LIST_INTLOGB_TESTS(long, long double, LIBC_NAMESPACE::llogbl);
>From 04843cf41b84439c4a5508a2b0cb04e6a9b21065 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <mathewjosephparakka at gmail.com>
Date: Tue, 27 Jan 2026 01:27:42 +0530
Subject: [PATCH 09/14] fix: moved test for llogbl to AllDouble section
---
libc/test/shared/shared_math_test.cpp | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index b27ef113717f0..b7aa2da7de262 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -152,6 +152,7 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
LIBC_NAMESPACE::shared::dfmal(0x0.p+0L, 0x0.p+0L, 0x0.p+0L));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fsqrtl(0.0L));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogbl(0x1.p+0L));
+ EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
}
#ifdef LIBC_TYPES_HAS_FLOAT128
@@ -179,7 +180,3 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
}
#endif // LIBC_TYPES_HAS_FLOAT128
-
-TEST(LlvmLibcSharedMathTest, AllLongDouble) {
- EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
-}
>From c3e469adba58066548f624aa6ed344503a778b7e Mon Sep 17 00:00:00 2001
From: Mathew Joseph <mathewjosephparakka at gmail.com>
Date: Tue, 27 Jan 2026 19:05:40 +0530
Subject: [PATCH 10/14] Fix: changes test for llogbl to AllLongDouble
---
libc/test/shared/shared_math_test.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index b7aa2da7de262..4c4198765deb3 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -132,16 +132,14 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
EXPECT_FP_EQ(0x1p+0, LIBC_NAMESPACE::shared::exp2(0.0));
EXPECT_FP_EQ(0x1p+0, LIBC_NAMESPACE::shared::exp10(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::expm1(0.0));
-<<<<<<< HEAD
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::fsqrt(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log(1.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log10(1.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log1p(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log2(1.0));
-=======
->>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::sin(0.0));
- EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::sqrt(0.0));
+ EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
+ EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogb(1.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::tan(0.0));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogb(1.0));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogb(1.0));
>From ec2c97e0ffc20de0a997eaa159f0b248aece23b6 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <mathewjosephparakka at gmail.com>
Date: Fri, 30 Jan 2026 12:42:21 +0530
Subject: [PATCH 11/14] fix: removed the collision and added dependency
---
libc/src/__support/math/CMakeLists.txt | 4 ++++
libc/test/shared/CMakeLists.txt | 3 ---
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 11 +++++++++++
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 8752a30178bea..c2fabedd0926a 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -798,6 +798,10 @@ add_header_library(
add_header_library(
<<<<<<< HEAD
+ libc.src.__support.macros.config
+)
+
+add_header_library(
llogbf
HDRS
llogbf.h
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index a0cb3dba2b652..def46d9f16baf 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -86,14 +86,11 @@ add_fp_unittest(
libc.src.__support.math.ldexpf
libc.src.__support.math.ldexpf128
libc.src.__support.math.ldexpf16
-<<<<<<< HEAD
libc.src.__support.math.llogbf
libc.src.__support.math.llogbf128
libc.src.__support.math.llogbf16
libc.src.__support.math.logf16
-=======
libc.src.__support.math.llogbl
->>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
libc.src.__support.math.rsqrtf
libc.src.__support.math.rsqrtf16
libc.src.__support.math.sqrtf16
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 0e98e02bb6724..05d5582397fb2 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3095,11 +3095,22 @@ libc_support_library(
],
)
+libc_support_library(
+ name = "__support_math_llogbl",
+ hdrs = ["src/__support/math/llogbl.h"],
+ deps = [
+ ":__support_fputil_manipulation_functions",
+ ":__support_macros_config",
+ ],
+)
+
libc_support_library(
name = "__support_math_llogbf",
hdrs = ["src/__support/math/llogbf.h"],
deps = [
+ ":__support_common",
":__support_fputil_manipulation_functions",
+ ":__support_macros_config",
],
)
>From 24cdf9e03593feaaa3fcb0aeb1e036dee646b040 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <mathewjosephparakka at gmail.com>
Date: Fri, 6 Feb 2026 23:00:42 +0530
Subject: [PATCH 12/14] refactor: remove static from llogbl inline signature to
align with 823e3e0
---
libc/shared/math.h | 5 +----
libc/src/__support/math/CMakeLists.txt | 18 ++++++++----------
libc/src/__support/math/llogbl.h | 3 ++-
libc/test/shared/shared_math_test.cpp | 4 ++--
.../llvm-project-overlay/libc/BUILD.bazel | 9 +--------
5 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 31ff3da7c8496..8360f724453fb 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -80,11 +80,11 @@
#include "math/ldexpf.h"
#include "math/ldexpf128.h"
#include "math/ldexpf16.h"
-<<<<<<< HEAD
#include "math/llogb.h"
#include "math/llogbf.h"
#include "math/llogbf128.h"
#include "math/llogbf16.h"
+#include "math/llogbl.h"
#include "math/log.h"
#include "math/log10.h"
#include "math/log1p.h"
@@ -94,9 +94,6 @@
#include "math/logbf16.h"
#include "math/logf.h"
#include "math/logf16.h"
-=======
-#include "math/llogbl.h"
->>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
#include "math/rsqrtf.h"
#include "math/rsqrtf16.h"
#include "math/sin.h"
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index c2fabedd0926a..f09b43a514640 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -797,14 +797,19 @@ add_header_library(
)
add_header_library(
-<<<<<<< HEAD
+ llogbf
+ HDRS
+ llogbf.h
+ DEPENDS
+ libc.src.__support.FPUtil.manipulation_functions
+ libc.src.__support.common
libc.src.__support.macros.config
)
add_header_library(
- llogbf
+ llogbl
HDRS
- llogbf.h
+ llogbl.h
DEPENDS
libc.src.__support.FPUtil.manipulation_functions
libc.src.__support.common
@@ -830,13 +835,6 @@ add_header_library(
libc.src.__support.macros.optimization
libc.src.__support.macros.properties.cpu_features
libc.include.llvm-libc-macros.float16_macros
-=======
- llogbl
- HDRS
- llogbl.h
- DEPENDS
- libc.src.__support.FPUtil.manipulation_functions
->>>>>>> 238d90f8ed77 (fix: [libc][math] Refactor llogbl implementation to header-only in src/__support/math folder)
)
add_header_library(
diff --git a/libc/src/__support/math/llogbl.h b/libc/src/__support/math/llogbl.h
index 03230f14313a4..58c9770613cd5 100644
--- a/libc/src/__support/math/llogbl.h
+++ b/libc/src/__support/math/llogbl.h
@@ -10,13 +10,14 @@
#define LLVM_LIBC_SRC___SUPPORT_MATH_LLOGBL_H
#include "src/__support/FPUtil/ManipulationFunctions.h"
+#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
namespace math {
-LIBC_INLINE static constexpr long llogbl(long double x) {
+LIBC_INLINE constexpr long llogbl(long double x) {
return fputil::intlogb<long>(x);
}
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 4c4198765deb3..20d32d789d604 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -138,7 +138,7 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log1p(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log2(1.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::sin(0.0));
- EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
+ EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbl(1.0L));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogb(1.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::tan(0.0));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogb(1.0));
@@ -150,7 +150,7 @@ TEST(LlvmLibcSharedMathTest, AllLongDouble) {
LIBC_NAMESPACE::shared::dfmal(0x0.p+0L, 0x0.p+0L, 0x0.p+0L));
EXPECT_FP_EQ(0x0p+0f, LIBC_NAMESPACE::shared::fsqrtl(0.0L));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogbl(0x1.p+0L));
- EXPECT_EQ(0, LIBC_NAMESPACE::shared::llogbl(1.0L));
+ EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbl(1.0L));
}
#ifdef LIBC_TYPES_HAS_FLOAT128
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 05d5582397fb2..a78b25e3bbf01 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -3099,6 +3099,7 @@ libc_support_library(
name = "__support_math_llogbl",
hdrs = ["src/__support/math/llogbl.h"],
deps = [
+ ":__support_common",
":__support_fputil_manipulation_functions",
":__support_macros_config",
],
@@ -3244,14 +3245,6 @@ libc_support_library(
],
)
-libc_support_library(
- name = "__support_math_llogbl",
- hdrs = ["src/__support/math/llogbl.h"],
- deps = [
- ":__support_fputil_manipulation_functions",
- ],
-)
-
libc_support_library(
name = "__support_math_exp_constants",
hdrs = ["src/__support/math/exp_constants.h"],
>From 446ba651503337c74bef625854e66a3be40ade02 Mon Sep 17 00:00:00 2001
From: Mathew Joseph <69132893+mathew1046 at users.noreply.github.com>
Date: Mon, 9 Feb 2026 19:08:53 +0530
Subject: [PATCH 13/14] Update libc/src/math/generic/llogbl.cpp
Co-authored-by: Muhammad Bassiouni <60100307+bassiounix at users.noreply.github.com>
---
libc/src/math/generic/llogbl.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/libc/src/math/generic/llogbl.cpp b/libc/src/math/generic/llogbl.cpp
index 2cf1851f77945..5c5e15ae19455 100644
--- a/libc/src/math/generic/llogbl.cpp
+++ b/libc/src/math/generic/llogbl.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "src/math/llogbl.h"
-#include "src/__support/common.h"
#include "src/__support/math/llogbl.h"
namespace LIBC_NAMESPACE_DECL {
>From 220c9453d7e0fcfdc6d78d49945c130f74f07e8d Mon Sep 17 00:00:00 2001
From: Mathew Joseph <69132893+mathew1046 at users.noreply.github.com>
Date: Mon, 9 Feb 2026 19:15:30 +0530
Subject: [PATCH 14/14] Replace llogbl test with sqrt test in shared_math_test
---
libc/test/shared/shared_math_test.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 20d32d789d604..554af59ca90c0 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -138,7 +138,7 @@ TEST(LlvmLibcSharedMathTest, AllDouble) {
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log1p(0.0));
EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::log2(1.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::sin(0.0));
- EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogbl(1.0L));
+ EXPECT_FP_EQ(0x0p+0, LIBC_NAMESPACE::shared::sqrt(0.0));
EXPECT_EQ(0L, LIBC_NAMESPACE::shared::llogb(1.0));
EXPECT_FP_EQ(0.0, LIBC_NAMESPACE::shared::tan(0.0));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::ilogb(1.0));
More information about the libc-commits
mailing list