[libc-commits] [libc] [libc][math] Implement fpclassify macro. (PR #109519)

via libc-commits libc-commits at lists.llvm.org
Sat Sep 21 08:08:53 PDT 2024


================
@@ -0,0 +1,49 @@
+//===-- Utility class to test the fpclassify macro  -------------*- 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_INCLUDE_MATH_FPCLASSIFY_H
+#define LLVM_LIBC_TEST_INCLUDE_MATH_FPCLASSIFY_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include "include/llvm-libc-macros/math-function-macros.h"
+
+template <typename T>
+class FpClassifyTest : public LIBC_NAMESPACE::testing::Test {
+  DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+  typedef int (*FpClassifyFunc)(T);
+
+  void testSpecialNumbers(FpClassifyFunc func) {
+    EXPECT_EQ(func(aNaN), 0);
----------------
lntue wrote:

Use `FP_*` constants instead.

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


More information about the libc-commits mailing list