42 lines · cpp
1//===-- Exhaustive test for atanf - float-only ----------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "exhaustive_test.h"10#include "src/__support/math/atanf_float.h"11#include "utils/MPFRWrapper/MPFRUtils.h"12 13namespace mpfr = LIBC_NAMESPACE::testing::mpfr;14 15float atanf_fast(float x) { return LIBC_NAMESPACE::math::atanf(x); }16 17using LlvmLibcAtanfFloatExhaustiveTest =18 LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Atan, atanf_fast,19 4>;20 21// Range: [0, Inf];22static constexpr uint32_t POS_START = 0x0000'0000U;23static constexpr uint32_t POS_STOP = 0x7f80'0000U;24 25TEST_F(LlvmLibcAtanfFloatExhaustiveTest, PostiveRange) {26 std::cout << "-- Testing for FE_TONEAREST in range [0x" << std::hex27 << POS_START << ", 0x" << POS_STOP << ") --" << std::dec28 << std::endl;29 test_full_range(mpfr::RoundingMode::Nearest, POS_START, POS_STOP);30}31 32// Range: [-Inf, 0];33static constexpr uint32_t NEG_START = 0x8000'0000U;34static constexpr uint32_t NEG_STOP = 0xff80'0000U;35 36TEST_F(LlvmLibcAtanfFloatExhaustiveTest, NegativeRange) {37 std::cout << "-- Testing for FE_TONEAREST in range [0x" << std::hex38 << NEG_START << ", 0x" << NEG_STOP << ") --" << std::dec39 << std::endl;40 test_full_range(mpfr::RoundingMode::Nearest, NEG_START, NEG_STOP);41}42