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