[libc-commits] [libc] [libc][math] Implement isnanf16 header-only function (PR #198115)
Aayush Shrivastava via libc-commits
libc-commits at lists.llvm.org
Sat May 23 02:28:35 PDT 2026
https://github.com/iamaayushrivastava updated https://github.com/llvm/llvm-project/pull/198115
>From 0c10dd64a505108a7b6ea9af2d2ffe7ae2a5945d Mon Sep 17 00:00:00 2001
From: Aayush Shrivastava <iamaayushrivastava at gmail.com>
Date: Sat, 16 May 2026 23:41:45 +0530
Subject: [PATCH 1/4] isnanf16: Implement LLVM libc header-only function
---
libc/config/baremetal/aarch64/entrypoints.txt | 1 +
libc/config/baremetal/arm/entrypoints.txt | 1 +
libc/config/baremetal/riscv/entrypoints.txt | 1 +
libc/config/darwin/aarch64/entrypoints.txt | 1 +
libc/config/gpu/amdgpu/entrypoints.txt | 1 +
libc/config/gpu/nvptx/entrypoints.txt | 1 +
libc/config/linux/aarch64/entrypoints.txt | 1 +
libc/config/linux/riscv/entrypoints.txt | 1 +
libc/config/linux/x86_64/entrypoints.txt | 1 +
libc/shared/math.h | 1 +
libc/shared/math/isnanf16.h | 29 ++++++++++
libc/src/__support/math/CMakeLists.txt | 10 ++++
libc/src/__support/math/isnanf16.h | 31 ++++++++++
libc/src/math/CMakeLists.txt | 1 +
libc/src/math/generic/CMakeLists.txt | 10 ++++
libc/src/math/generic/isnanf16.cpp | 17 ++++++
libc/src/math/isnanf16.h | 21 +++++++
libc/test/shared/CMakeLists.txt | 2 +
.../shared/shared_math_constexpr_test.cpp | 1 +
libc/test/shared/shared_math_test.cpp | 1 +
libc/test/src/math/smoke/CMakeLists.txt | 12 ++++
libc/test/src/math/smoke/IsNanTest.h | 56 +++++++++++++++++++
libc/test/src/math/smoke/isnanf16_test.cpp | 13 +++++
23 files changed, 214 insertions(+)
create mode 100644 libc/shared/math/isnanf16.h
create mode 100644 libc/src/__support/math/isnanf16.h
create mode 100644 libc/src/math/generic/isnanf16.cpp
create mode 100644 libc/src/math/isnanf16.h
create mode 100644 libc/test/src/math/smoke/IsNanTest.h
create mode 100644 libc/test/src/math/smoke/isnanf16_test.cpp
diff --git a/libc/config/baremetal/aarch64/entrypoints.txt b/libc/config/baremetal/aarch64/entrypoints.txt
index 452abd985b3a5..15fa533167d9c 100644
--- a/libc/config/baremetal/aarch64/entrypoints.txt
+++ b/libc/config/baremetal/aarch64/entrypoints.txt
@@ -653,6 +653,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 41c80efc64227..8f399ae7c7f8f 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -665,6 +665,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index 88eacfae12969..cf108b434115a 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -661,6 +661,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/darwin/aarch64/entrypoints.txt b/libc/config/darwin/aarch64/entrypoints.txt
index 914d2b7918da1..01ae40c898734 100644
--- a/libc/config/darwin/aarch64/entrypoints.txt
+++ b/libc/config/darwin/aarch64/entrypoints.txt
@@ -474,6 +474,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index c76900a8371f7..bbd15a131ca24 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -595,6 +595,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 6538732f785f5..ade635e095994 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -597,6 +597,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 9994a9294173d..92b4910a60425 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -764,6 +764,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.getpayloadf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index 2748b2b8e6a5d..89566733aae7a 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -780,6 +780,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 4b551ced82138..8aec89e64a0fc 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -836,6 +836,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.hypotf16
libc.src.math.ilogbf16
libc.src.math.iscanonicalf16
+ libc.src.math.isnanf16
libc.src.math.issignalingf16
libc.src.math.ldexpf16
libc.src.math.llogbf16
diff --git a/libc/shared/math.h b/libc/shared/math.h
index 73005f99a2db4..049fcf0b38072 100644
--- a/libc/shared/math.h
+++ b/libc/shared/math.h
@@ -289,6 +289,7 @@
#include "math/iscanonicall.h"
#include "math/isnan.h"
#include "math/isnanf.h"
+#include "math/isnanf16.h"
#include "math/isnanl.h"
#include "math/issignaling.h"
#include "math/issignalingbf16.h"
diff --git a/libc/shared/math/isnanf16.h b/libc/shared/math/isnanf16.h
new file mode 100644
index 0000000000000..cac3b1ee13f51
--- /dev/null
+++ b/libc/shared/math/isnanf16.h
@@ -0,0 +1,29 @@
+//===-- Shared isnanf16 function --------------------------------*- 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_SHARED_MATH_ISNANF16_H
+#define LLVM_LIBC_SHARED_MATH_ISNANF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "shared/libc_common.h"
+#include "src/__support/math/isnanf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace shared {
+
+using math::isnanf16;
+
+} // namespace shared
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SHARED_MATH_ISNANF16_H
diff --git a/libc/src/__support/math/CMakeLists.txt b/libc/src/__support/math/CMakeLists.txt
index 9e3ec26cdc881..b6b397c88a256 100644
--- a/libc/src/__support/math/CMakeLists.txt
+++ b/libc/src/__support/math/CMakeLists.txt
@@ -1704,6 +1704,16 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ isnanf16
+ HDRS
+ isnanf16.h
+ DEPENDS
+ libc.include.llvm-libc-macros.float16_macros
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.macros.config
+)
+
add_header_library(
issignaling
HDRS
diff --git a/libc/src/__support/math/isnanf16.h b/libc/src/__support/math/isnanf16.h
new file mode 100644
index 0000000000000..2f18fca5f53b7
--- /dev/null
+++ b/libc/src/__support/math/isnanf16.h
@@ -0,0 +1,31 @@
+//===-- Implementation header for isnanf16 ----------------------*- 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_ISNANF16_H
+#define LLVM_LIBC_SRC___SUPPORT_MATH_ISNANF16_H
+
+#include "include/llvm-libc-macros/float16-macros.h"
+
+#ifdef LIBC_TYPES_HAS_FLOAT16
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+namespace math {
+
+LIBC_INLINE constexpr int isnanf16(float16 x) {
+ return fputil::FPBits<float16>(x).is_nan();
+}
+
+} // namespace math
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LIBC_TYPES_HAS_FLOAT16
+
+#endif // LLVM_LIBC_SRC___SUPPORT_MATH_ISNANF16_H
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index b53817e2a1729..f707f2d366c26 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -368,6 +368,7 @@ add_math_entrypoint_object(ilogbbf16)
add_math_entrypoint_object(isnan)
add_math_entrypoint_object(isnanf)
add_math_entrypoint_object(isnanl)
+add_math_entrypoint_object(isnanf16)
add_math_entrypoint_object(issignaling)
add_math_entrypoint_object(issignalingf)
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 7ccbddba07b8d..4c3eac4c3356c 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3041,6 +3041,16 @@ add_entrypoint_object(
libc.src.__support.math.isnanl
)
+add_entrypoint_object(
+ isnanf16
+ SRCS
+ isnanf16.cpp
+ HDRS
+ ../isnanf16.h
+ DEPENDS
+ libc.src.__support.math.isnanf16
+)
+
add_entrypoint_object(
nan
SRCS
diff --git a/libc/src/math/generic/isnanf16.cpp b/libc/src/math/generic/isnanf16.cpp
new file mode 100644
index 0000000000000..e9c4d11e1f302
--- /dev/null
+++ b/libc/src/math/generic/isnanf16.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of isnanf16 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/isnanf16.h"
+#include "src/__support/math/isnanf16.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, isnanf16, (float16 x)) { return math::isnanf16(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/isnanf16.h b/libc/src/math/isnanf16.h
new file mode 100644
index 0000000000000..7dd2656b2c097
--- /dev/null
+++ b/libc/src/math/isnanf16.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for isnanf16 ----------------------*- 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_MATH_ISNANF16_H
+#define LLVM_LIBC_SRC_MATH_ISNANF16_H
+
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+int isnanf16(float16 x);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_ISNANF16_H
diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt
index 84a8d4bf79b3d..e86b0a45eb77c 100644
--- a/libc/test/shared/CMakeLists.txt
+++ b/libc/test/shared/CMakeLists.txt
@@ -286,6 +286,7 @@ add_fp_unittest(
libc.src.__support.math.iscanonicall
libc.src.__support.math.isnan
libc.src.__support.math.isnanf
+ libc.src.__support.math.isnanf16
libc.src.__support.math.isnanl
libc.src.__support.math.issignaling
libc.src.__support.math.issignalingbf16
@@ -658,6 +659,7 @@ add_fp_unittest(
libc.src.__support.math.iscanonicall
libc.src.__support.math.isnan
libc.src.__support.math.isnanf
+ libc.src.__support.math.isnanf16
libc.src.__support.math.isnanl
libc.src.__support.math.issignaling
libc.src.__support.math.issignalingbf16
diff --git a/libc/test/shared/shared_math_constexpr_test.cpp b/libc/test/shared/shared_math_constexpr_test.cpp
index 087a0cf9ba530..0fb5a2e3e66e7 100644
--- a/libc/test/shared/shared_math_constexpr_test.cpp
+++ b/libc/test/shared/shared_math_constexpr_test.cpp
@@ -261,6 +261,7 @@ static_assert(0.0f16 == LIBC_NAMESPACE::shared::nearbyintf16(0.0f16));
static_assert(0.0f16 == LIBC_NAMESPACE::shared::nextafterf16(0.0f16, 0.0f16));
static_assert(0.0f16 == LIBC_NAMESPACE::shared::rintf16(0.0f16));
static_assert(1 == LIBC_NAMESPACE::shared::iscanonicalf16(0.0f16));
+static_assert(0 == LIBC_NAMESPACE::shared::isnanf16(0.0f16));
static_assert(0.0 == LIBC_NAMESPACE::shared::issignalingf16(0.0f16));
static_assert(1 == [] {
const char arg{};
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index 6257ab64da666..f449e49d2b376 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -150,6 +150,7 @@ TEST(LlvmLibcSharedMathTest, AllFloat16) {
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::nearbyintf16(0.0f16));
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::rintf16(0.0f16));
EXPECT_EQ(1, LIBC_NAMESPACE::shared::iscanonicalf16(0.0f16));
+ EXPECT_EQ(0, LIBC_NAMESPACE::shared::isnanf16(0.0f16));
EXPECT_EQ(0, LIBC_NAMESPACE::shared::issignalingf16(0.0f16));
EXPECT_TRUE(FPBits(LIBC_NAMESPACE::shared::nanf16("")).is_nan());
EXPECT_FP_EQ(0x0p+0f16, LIBC_NAMESPACE::shared::roundf16(0.0f16));
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 28b85b1a25bbd..bb462afb71b91 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -2132,6 +2132,18 @@ add_fp_unittest(
libc.src.__support.FPUtil.bfloat16
)
+add_fp_unittest(
+ isnanf16_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ isnanf16_test.cpp
+ HDRS
+ IsNanTest.h
+ DEPENDS
+ libc.src.math.isnanf16
+)
+
add_fp_unittest(
llogb_test
SUITE
diff --git a/libc/test/src/math/smoke/IsNanTest.h b/libc/test/src/math/smoke/IsNanTest.h
new file mode 100644
index 0000000000000..8fe53f81a849b
--- /dev/null
+++ b/libc/test/src/math/smoke/IsNanTest.h
@@ -0,0 +1,56 @@
+//===-- Utility class to test different flavors of isnan --------*- 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_TEST_SRC_MATH_SMOKE_ISNANTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_ISNANTEST_H
+
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename T>
+class IsNanTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+ DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+ typedef int (*IsNanFunc)(T);
+
+ void testSpecialNumbers(IsNanFunc func) {
+ EXPECT_EQ(func(aNaN), 1);
+ EXPECT_EQ(func(neg_aNaN), 1);
+ EXPECT_EQ(func(sNaN), 1);
+ EXPECT_EQ(func(neg_sNaN), 1);
+ EXPECT_EQ(func(inf), 0);
+ EXPECT_EQ(func(neg_inf), 0);
+ EXPECT_EQ(func(min_normal), 0);
+ EXPECT_EQ(func(max_normal), 0);
+ EXPECT_EQ(func(neg_max_normal), 0);
+ EXPECT_EQ(func(min_denormal), 0);
+ EXPECT_EQ(func(neg_min_denormal), 0);
+ EXPECT_EQ(func(max_denormal), 0);
+ EXPECT_EQ(func(zero), 0);
+ EXPECT_EQ(func(neg_zero), 0);
+ }
+
+ void testRoundedNumbers(IsNanFunc func) {
+ EXPECT_EQ(func(T(1.0)), 0);
+ EXPECT_EQ(func(T(-1.0)), 0);
+ EXPECT_EQ(func(T(10.0)), 0);
+ EXPECT_EQ(func(T(-10.0)), 0);
+ EXPECT_EQ(func(T(1234.0)), 0);
+ EXPECT_EQ(func(T(-1234.0)), 0);
+ }
+};
+
+#define LIST_ISNAN_TESTS(T, func) \
+ using LlvmLibcIsNanTest = IsNanTest<T>; \
+ TEST_F(LlvmLibcIsNanTest, SpecialNumbers) { testSpecialNumbers(&func); } \
+ TEST_F(LlvmLibcIsNanTest, RoundedNumbers) { testRoundedNumbers(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_ISNANTEST_H
diff --git a/libc/test/src/math/smoke/isnanf16_test.cpp b/libc/test/src/math/smoke/isnanf16_test.cpp
new file mode 100644
index 0000000000000..a398a0b44dd90
--- /dev/null
+++ b/libc/test/src/math/smoke/isnanf16_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for isnanf16 --------------------------------------------===//
+//
+// 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 "IsNanTest.h"
+
+#include "src/math/isnanf16.h"
+
+LIST_ISNAN_TESTS(float16, LIBC_NAMESPACE::isnanf16)
>From 032a8522f28e5497266f7f9f89e9d87c08c6b99a Mon Sep 17 00:00:00 2001
From: Aayush Shrivastava
<79578660+iamaayushrivastava at users.noreply.github.com>
Date: Mon, 18 May 2026 18:46:52 +0530
Subject: [PATCH 2/4] Update libc/test/src/math/smoke/IsNanTest.h
Co-authored-by: Victor Campos <github at victorcampos.me>
---
libc/test/src/math/smoke/IsNanTest.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/test/src/math/smoke/IsNanTest.h b/libc/test/src/math/smoke/IsNanTest.h
index 8fe53f81a849b..16d57f03c04db 100644
--- a/libc/test/src/math/smoke/IsNanTest.h
+++ b/libc/test/src/math/smoke/IsNanTest.h
@@ -19,7 +19,7 @@ class IsNanTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
DECLARE_SPECIAL_CONSTANTS(T)
public:
- typedef int (*IsNanFunc)(T);
+using IsNanFunc = int (*)(T);
void testSpecialNumbers(IsNanFunc func) {
EXPECT_EQ(func(aNaN), 1);
>From 315d8e650a2238db580e6f38e1f19800094ca3e4 Mon Sep 17 00:00:00 2001
From: Aayush Shrivastava
<79578660+iamaayushrivastava at users.noreply.github.com>
Date: Tue, 19 May 2026 14:28:17 +0530
Subject: [PATCH 3/4] Update libc/src/math/generic/isnanf16.cpp
---
libc/src/math/generic/isnanf16.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libc/src/math/generic/isnanf16.cpp b/libc/src/math/generic/isnanf16.cpp
index e9c4d11e1f302..fa525636c9c06 100644
--- a/libc/src/math/generic/isnanf16.cpp
+++ b/libc/src/math/generic/isnanf16.cpp
@@ -1,5 +1,4 @@
-//===-- Implementation of isnanf16 function
-//--------------------------------===//
+//===-- Implementation of isnanf16 function-------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
>From 8c7830d72d2910600255511bf418e6a4da96cbbc Mon Sep 17 00:00:00 2001
From: Aayush Shrivastava
<79578660+iamaayushrivastava at users.noreply.github.com>
Date: Fri, 22 May 2026 23:41:58 +0530
Subject: [PATCH 4/4] Update libc/src/math/CMakeLists.txt
---
libc/src/math/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index f707f2d366c26..730c0c06073e1 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -367,8 +367,8 @@ add_math_entrypoint_object(ilogbbf16)
add_math_entrypoint_object(isnan)
add_math_entrypoint_object(isnanf)
-add_math_entrypoint_object(isnanl)
add_math_entrypoint_object(isnanf16)
+add_math_entrypoint_object(isnanl)
add_math_entrypoint_object(issignaling)
add_math_entrypoint_object(issignalingf)
More information about the libc-commits
mailing list