xref: /llvm-project/libc/test/src/math/exhaustive/expf_test.cpp (revision b6bc9d72f65a5086f310f321e969d96e9a559e75)
138cadd90STue Ly //===-- Exhaustive test for expf ------------------------------------------===//
238cadd90STue Ly //
338cadd90STue Ly // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
438cadd90STue Ly // See https://llvm.org/LICENSE.txt for license information.
538cadd90STue Ly // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
638cadd90STue Ly //
738cadd90STue Ly //===----------------------------------------------------------------------===//
838cadd90STue Ly 
938cadd90STue Ly #include "exhaustive_test.h"
1038cadd90STue Ly #include "src/math/expf.h"
1138cadd90STue Ly #include "utils/MPFRWrapper/MPFRUtils.h"
1238cadd90STue Ly 
13*b6bc9d72SGuillaume Chatelet namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
1438cadd90STue Ly 
159532074aSTue Ly using LlvmLibcExpfExhaustiveTest =
169532074aSTue Ly     LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp,
17*b6bc9d72SGuillaume Chatelet                                       LIBC_NAMESPACE::expf>;
1838cadd90STue Ly 
199532074aSTue Ly // Range: [0, Inf];
2038cadd90STue Ly static constexpr uint32_t POS_START = 0x0000'0000U;
219532074aSTue Ly static constexpr uint32_t POS_STOP = 0x7f80'0000U;
2238cadd90STue Ly 
TEST_F(LlvmLibcExpfExhaustiveTest,PostiveRange)239532074aSTue Ly TEST_F(LlvmLibcExpfExhaustiveTest, PostiveRange) {
249532074aSTue Ly   test_full_range_all_roundings(POS_START, POS_STOP);
2538cadd90STue Ly }
2638cadd90STue Ly 
279532074aSTue Ly // Range: [-Inf, 0];
289532074aSTue Ly static constexpr uint32_t NEG_START = 0xb000'0000U;
299532074aSTue Ly static constexpr uint32_t NEG_STOP = 0xff80'0000U;
3038cadd90STue Ly 
TEST_F(LlvmLibcExpfExhaustiveTest,NegativeRange)319532074aSTue Ly TEST_F(LlvmLibcExpfExhaustiveTest, NegativeRange) {
329532074aSTue Ly   test_full_range_all_roundings(NEG_START, NEG_STOP);
3338cadd90STue Ly }
34