[libc-commits] [libc] [libc][math] implement `signbit` (PR #97791)
via libc-commits
libc-commits at lists.llvm.org
Sun Jul 7 18:10:56 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;
----------------
akielaries wrote:
This sounds good. Since we're testing 4 macros, should that mean 4 classes for each macro and a `_test.cpp` file for each floating point type similar to what is done for `fabs` here:
- [`fabs_test.cpp`](https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/smoke/fabs_test.cpp)
- [`fabsf128_test.cpp`](https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/smoke/fabsf128_test.cpp)
- [`fabsf16_test.cpp`](https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/smoke/fabsf16_test.cpp)
- [`fabsf_test.cpp`](https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/smoke/fabsf_test.cpp)
- [`fabsl_test.cpp`](https://github.com/llvm/llvm-project/blob/main/libc/test/src/math/smoke/fabsl_test.cpp)
https://github.com/llvm/llvm-project/pull/97791
More information about the libc-commits
mailing list