[libc-commits] [libc] [libc][math] Implement fast pass for double precision pow function with up to 1ULP error. (PR #101926)

via libc-commits libc-commits at lists.llvm.org
Mon Aug 5 06:34:59 PDT 2024


================
@@ -0,0 +1,188 @@
+//===-- Unittests for pow -------------------------------------------------===//
+//
+// 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 "hdr/math_macros.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/math/pow.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+using LlvmLibcPowTest = LIBC_NAMESPACE::testing::FPTest<double>;
+using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode;
+using LIBC_NAMESPACE::fputil::testing::RoundingMode;
+
+TEST_F(LlvmLibcPowTest, SpecialNumbers) {
+  constexpr double neg_odd_integer = -3.0;
+  constexpr double neg_even_integer = -6.0;
+  constexpr double neg_non_integer = -1.1;
+  constexpr double pos_odd_integer = 5.0;
+  constexpr double pos_even_integer = 8.0;
+  constexpr double pos_non_integer = 1.1;
----------------
lntue wrote:

Done.

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


More information about the libc-commits mailing list