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

Shourya Goel via libc-commits libc-commits at lists.llvm.org
Wed Jan 8 06:20:25 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);
----------------
Sh0g0-1758 wrote:

yeah sure. This PR is not meant for `cargf`. I just used it to verify my implementation. I think I would like to first get this merged and then work on `carg` variants. I have created an issue for this here #122114

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


More information about the libc-commits mailing list