[libc-commits] [libc] [llvm] [libc][math] Implement double-precision acosh (PR #199953)

Aayush Shrivastava via libc-commits libc-commits at lists.llvm.org
Sun May 31 03:35:53 PDT 2026


================
@@ -0,0 +1,85 @@
+//===-- Unittests for acosh -----------------------------------------------===//
+//
+// 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 "src/__support/FPUtil/FPBits.h"
+#include "src/math/acosh.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+
+using LlvmLibcAcoshTest = LIBC_NAMESPACE::testing::FPTest<double>;
+
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+
+using LIBC_NAMESPACE::testing::tlog;
+
+TEST_F(LlvmLibcAcoshTest, InDoubleRange) {
+  // acosh is defined on [1, +inf).
+  // Sweep uniformly in bit-space over [1.0, 2^52].
+  constexpr uint64_t COUNT = 123'451;
+  uint64_t START = FPBits(1.0).uintval();
+  uint64_t STOP = FPBits(0x1.0p52).uintval(); // 2^52
+  uint64_t STEP = (STOP - START) / COUNT;
----------------
iamaayushrivastava wrote:

Done. START, STOP, and STEP are now `constexpr`.

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


More information about the libc-commits mailing list