[libc-commits] [libc] [libc][math][c23] Implement canonicalize functions (PR #85940)
via libc-commits
libc-commits at lists.llvm.org
Thu Mar 21 21:46:45 PDT 2024
================
@@ -0,0 +1,54 @@
+//===-- Utility class to test canonicalize[f|l] -----------------*- 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_CANONICALIZETEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_CANONICALIZETEST_H
+
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+#include <math.h>
+
+template <typename T>
+class CanonicalizeTest : public LIBC_NAMESPACE::testing::Test {
+
+ DECLARE_SPECIAL_CONSTANTS(T)
+
+public:
+ typedef T (*CanonicalizeFunc)(T);
+
+ void testSpecialNumbers(CanonicalizeFunc func) {
+ EXPECT_FP_EQ(zero, func(zero));
+ EXPECT_FP_EQ(neg_zero, func(neg_zero));
+
----------------
lntue wrote:
Add test for signaling nan.
https://github.com/llvm/llvm-project/pull/85940
More information about the libc-commits
mailing list