[libc-commits] [libc] [libc][math][c23] Add atanhf16 C23 math function. (PR #132612)
via libc-commits
libc-commits at lists.llvm.org
Wed Mar 26 10:01:41 PDT 2025
================
@@ -0,0 +1,86 @@
+//===-- Implementation of atanh(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/atanhf16.h"
+#include "explogxf.h"
+#include "hdr/errno_macros.h"
+#include "hdr/fenv_macros.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/PolyEval.h"
+#include "src/__support/FPUtil/cast.h"
+#include "src/__support/FPUtil/multiply_add.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float16, atanhf16, (float16 x)) {
+ using FPBits = typename fputil::FPBits<float16>;
+
+ FPBits xbits(x);
+ Sign sign = xbits.sign();
+ uint16_t x_abs = xbits.abs().uintval();
+
+ if (LIBC_UNLIKELY(x_abs >= 0x3c00U)) {
----------------
overmighty wrote:
```suggestion
// |x| >= 1
if (LIBC_UNLIKELY(x_abs >= 0x3c00U)) {
```
https://github.com/llvm/llvm-project/pull/132612
More information about the libc-commits
mailing list