[libc-commits] [libc] [libc][math][c23] Add acospif16() function (PR #132754)

via libc-commits libc-commits at lists.llvm.org
Tue Mar 25 08:23:54 PDT 2025


================
@@ -0,0 +1,21 @@
+//===-- Half-precision acospif16(x) 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/math/acospif16.h"
+#include "src/__support/FPUtil/cast.h"
+
+namespace LIBC_NAMESPACE_DECL {
+// Generated by Sollya using the following command:
+// > round(pi, SG, RN);
+static constexpr float PI = 0x1.921fb6p1f;
+
+LLVM_LIBC_FUNCTION(float16, acospif16, (float16 x)) {
+    return fputil::cast<float16>(acosf16(x) / PI);  
----------------
amemov wrote:

> `acospif16` needs to have a separate implementation, independent from `acosf16`.

Thanks for the feedback! I was most concerned about this part. 

I do have a question: is there any reason why `acosf16` can't be reused like that in `acospif16`?

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


More information about the libc-commits mailing list