[libc-commits] [libc] [libc][complex] Testing infra for MPC (PR #121261)

via libc-commits libc-commits at lists.llvm.org
Wed Jan 8 05:47:26 PST 2025


================
@@ -0,0 +1,21 @@
+//===-- Implementation of cargf 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/complex/cargf.h"
+#include "src/__support/common.h"
+#include "src/__support/complex_type.h"
+#include "src/math/atan2f.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, cargf, (_Complex float x)) {
+  Complex<float> x_c = cpp::bit_cast<Complex<float>>(x);
+  return atan2f(x_c.imag, x_c.real);
----------------
lntue wrote:

Can you create a separate PR for `cargf` in which `atan2f` implementation is refactored to a common internal function, maybe `LIBC_NAMESPACE::generic::atan2f` or `LIBC_NAMESPACE::impl::atan2f` to be called by both `atan2f` and `cargf`, so that these 2 entrypoints are independent of each other?

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


More information about the libc-commits mailing list