[libc-commits] [libc] [llvm] [libc][math][c23] Fix signed zeros in `tanpif` and `tanpif16` (PR #230371)

Connector Switch via libc-commits libc-commits at lists.llvm.org
Fri Oct 23 03:52:34 PDT 2026


================
@@ -0,0 +1,59 @@
+//===-- Shared tanpi utilities --------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_MATH_TANPI_UTILS_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_TANPI_UTILS_H
+
+#include "src/__support/CPP/bit.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/attributes.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+namespace tanpi_internal {
+
+// These helpers require finite inputs.
+
+// Check if x is an odd integer: its lowest set significand bit must be at the
+// unit position, so x_e + lsb == UNIT_EXPONENT.
+template <typename T> LIBC_INLINE constexpr bool is_odd_integer(T x) {
----------------
c8ef wrote:

Done.

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


More information about the libc-commits mailing list