[libc-commits] [libc] [libc][math] implement `signbit` (PR #97791)

via libc-commits libc-commits at lists.llvm.org
Sat Jul 6 07:40:21 PDT 2024


================
@@ -0,0 +1,87 @@
+//===-- Unittests for generic-math-macros ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "test/UnitTest/Test.h"
+
+/*
+ * The intent of this test is validate that the generic math macros operate as
+ * intended
+ */
+#include "include/llvm-libc-macros/generic-math-macros.h"
+
+// INF can be defined as a number with zeroed out mantissa and 1s in the 
+// exponent
+static uint32_t pos_inf_bits = 0x7F800000;
----------------
lntue wrote:

You should create a generic test class to test for different floating point types, similar to: https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/smoke/FAbsTest.h

All the special typed constants will be automatically available: https://github.com/llvm/llvm-project/blob/main/libc/test/UnitTest/FPMatcher.h#L69


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


More information about the libc-commits mailing list