| 1 | //===-- Exhaustive test for atanhf ----------------------------------------===// |
| 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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "exhaustive_test.h" |
| 10 | #include "src/__support/FPUtil/FPBits.h" |
| 11 | #include "src/math/atanhf.h" |
| 12 | #include "utils/MPFRWrapper/MPFRUtils.h" |
| 13 | |
| 14 | using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; |
| 15 | |
| 16 | using LlvmLibcAtanhfExhaustiveTest = |
| 17 | LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Atanh, |
| 18 | LIBC_NAMESPACE::atanhf>; |
| 19 | |
| 20 | // Range: [0, 1.0]; |
| 21 | static const uint32_t POS_START = 0x0000'0000U; |
| 22 | static const uint32_t POS_STOP = FPBits(1.0f).uintval(); |
| 23 | |
| 24 | TEST_F(LlvmLibcAtanhfExhaustiveTest, PostiveRange) { |
| 25 | test_full_range_all_roundings(POS_START, POS_STOP); |
| 26 | } |
| 27 | |
| 28 | // Range: [-1.0, 0]; |
| 29 | static const uint32_t NEG_START = 0x8000'0000U; |
| 30 | static const uint32_t NEG_STOP = FPBits(-1.0f).uintval(); |
| 31 | |
| 32 | TEST_F(LlvmLibcAtanhfExhaustiveTest, NegativeRange) { |
| 33 | test_full_range_all_roundings(NEG_START, NEG_STOP); |
| 34 | } |
| 35 | |