[libc-commits] [libc] [libc][math] Implement fast pass for double precision atan2 with 1 ULP errors. (PR #100648)
via libc-commits
libc-commits at lists.llvm.org
Thu Jul 25 14:25:12 PDT 2024
================
@@ -0,0 +1,131 @@
+//===-- Unittests for atan2 -----------------------------------------------===//
+//
+// 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/atan2.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+
+using LlvmLibcAtan2Test = LIBC_NAMESPACE::testing::FPTest<double>;
+using LIBC_NAMESPACE::testing::tlog;
+
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+
+TEST_F(LlvmLibcAtan2Test, TrickyInputs) {
+ mpfr::BinaryInput<double> INPUTS[] = {
+ {0x1.0853408534085p-2, 0x1.e7b54166c6126p-2},
+ {FPBits::inf().get_val(), 0x0.0000000000001p-1022},
+ };
----------------
overmighty wrote:
Nit: `INPUTS` is non-`const`, so its name should not be in uppercase.
```suggestion
mpfr::BinaryInput<double> inputs[] = {
{0x1.0853408534085p-2, 0x1.e7b54166c6126p-2},
{FPBits::inf().get_val(), 0x0.0000000000001p-1022},
};
```
https://github.com/llvm/llvm-project/pull/100648
More information about the libc-commits
mailing list