Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libc / test / src / math / inv_trigf_utils_test.cpp
blob23420edcd0ca1ab47b55f75c9569f8c7523bf3df
1 //===-- Unittests for supfuncf --------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "in_float_range_test_helper.h"
10 #include "src/__support/FPUtil/FPBits.h"
11 #include "src/math/generic/inv_trigf_utils.h"
12 #include "test/UnitTest/FPMatcher.h"
13 #include "test/UnitTest/Test.h"
14 #include "utils/MPFRWrapper/MPFRUtils.h"
15 #include <math.h>
17 using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
19 namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
21 constexpr int def_count = 100003;
22 constexpr float def_prec = 0.500001f;
24 auto f_normal = [](float x) -> bool { return !(isnan(x) || isinf(x)); };
26 TEST_F(LlvmLibcAtanfTest, InPositiveRange) {
27 CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval,
28 f_normal, def_count, def_prec);
31 TEST_F(LlvmLibcAtanfTest, InNegativeRange) {
32 CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval,
33 f_normal, def_count, def_prec);