xref: /llvm-project/libc/test/src/math/exhaustive/exp10f_test.cpp (revision b6bc9d72f65a5086f310f321e969d96e9a559e75)
1a752460dSTue Ly //===-- Exhaustive test for exp10f ----------------------------------------===//
2a752460dSTue Ly //
3a752460dSTue Ly // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4a752460dSTue Ly // See https://llvm.org/LICENSE.txt for license information.
5a752460dSTue Ly // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6a752460dSTue Ly //
7a752460dSTue Ly //===----------------------------------------------------------------------===//
8a752460dSTue Ly 
9a752460dSTue Ly #include "exhaustive_test.h"
10a752460dSTue Ly #include "src/math/exp10f.h"
11a752460dSTue Ly #include "utils/MPFRWrapper/MPFRUtils.h"
12a752460dSTue Ly 
13*b6bc9d72SGuillaume Chatelet namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
14a752460dSTue Ly 
159532074aSTue Ly using LlvmLibcExp10fExhaustiveTest =
169532074aSTue Ly     LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp10,
17*b6bc9d72SGuillaume Chatelet                                       LIBC_NAMESPACE::exp10f>;
18a752460dSTue Ly 
199532074aSTue Ly // Range: [0, Inf];
20a752460dSTue Ly static constexpr uint32_t POS_START = 0x0000'0000U;
219532074aSTue Ly static constexpr uint32_t POS_STOP = 0x7f80'0000U;
22a752460dSTue Ly 
TEST_F(LlvmLibcExp10fExhaustiveTest,PostiveRange)239532074aSTue Ly TEST_F(LlvmLibcExp10fExhaustiveTest, PostiveRange) {
249532074aSTue Ly   test_full_range_all_roundings(POS_START, POS_STOP);
25a752460dSTue Ly }
26a752460dSTue 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;
30a752460dSTue Ly 
TEST_F(LlvmLibcExp10fExhaustiveTest,NegativeRange)319532074aSTue Ly TEST_F(LlvmLibcExp10fExhaustiveTest, NegativeRange) {
329532074aSTue Ly   test_full_range_all_roundings(NEG_START, NEG_STOP);
33a752460dSTue Ly }
34