1 //===-- Unittests for fmul ------------------------------------------------===// 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 "MulTest.h" 10 11 #include "src/math/fmul.h" 12 13 #include "test/UnitTest/Test.h" 14 #include "utils/MPFRWrapper/MPFRUtils.h" 15 16 LIST_MUL_TESTS(float, double, LIBC_NAMESPACE::fmul) 17 18 TEST_F(LlvmLibcMulTest, SpecialInputs) { 19 namespace mpfr = LIBC_NAMESPACE::testing::mpfr; 20 double INPUTS[][2] = { 21 {0x1.0100010002p8, 0x1.fffcp14}, 22 {0x1.000000b92144p-7, 0x1.62p7}, 23 }; 24 25 for (size_t i = 0; i < 2; ++i) { 26 double a = INPUTS[i][0]; 27 28 for (int j = 0; j < 180; ++j) { 29 a *= 0.5; 30 mpfr::BinaryInput<double> input{a, INPUTS[i][1]}; 31 ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Mul, input, 32 LIBC_NAMESPACE::fmul(a, INPUTS[i][1]), 33 0.5); 34 } 35 } 36 } 37