1 //===-- Exhaustive test for expm1f-----------------------------------------===//
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/__support/FPUtil/TestHelpers.h"
11 #include "src/math/expm1f.h"
12 #include "utils/MPFRWrapper/MPFRUtils.h"
13 #include <math.h>
14 
15 using FPBits = __llvm_libc::fputil::FPBits<float>;
16 
17 namespace mpfr = __llvm_libc::testing::mpfr;
18 
19 TEST(LlvmLibcExpm1fExhaustiveTest, AllValues) {
20   uint32_t bits = 0;
21   do {
22     FPBits x(bits);
23     if (!x.is_inf_or_nan() && float(x) < 88.70f) {
24       ASSERT_MPFR_MATCH(mpfr::Operation::Expm1, float(x),
25                         __llvm_libc::expm1f(float(x)), 1.5);
26     }
27   } while (bits++ < 0xffff'ffffU);
28 }
29