1 //===-- Exhaustive test for logf ------------------------------------------===//
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 "src/__support/FPUtil/FPBits.h"
10 #include "src/math/logf.h"
11 #include "utils/MPFRWrapper/MPFRUtils.h"
12 #include "utils/UnitTest/FPMatcher.h"
13 #include "utils/UnitTest/Test.h"
14 
15 using FPBits = __llvm_libc::fputil::FPBits<float>;
16 
17 namespace mpfr = __llvm_libc::testing::mpfr;
18 
19 TEST(LlvmLibcLogfExhaustiveTest, AllValues) {
20   uint32_t bits = 0U;
21   do {
22     FPBits xbits(bits);
23     float x = float(xbits);
24     EXPECT_MPFR_MATCH(mpfr::Operation::Log, x, __llvm_libc::logf(x), 0.5);
25   } while (bits++ < 0x7f7f'ffffU);
26 }
27